CREATE proc valida @Venue_Name char(30),@Start_Date nvarchar(8),@End_Date nvarchar(8),@Venue_Rent int output as select a.Venue_Name,a.Start_Date,a.End_Date,b.Venue_Rent from Upcoming_event a, Venue_Details b where a.Venue_Name = @Venue_Name and b.Venue_Name = @Venue_Name and Start_Date = @Start_Date and End_Date = @End_Date and Venue_Rent = @Venue_Rent
which has been successfully created.
So i try to use a datareader to display the three things but fails and moves on to the next statement
cperson = TextBox1.Text
phone = Val(TextBox2.Text)
company = TextBox3.Text
address = TextBox4.Text
noatt = Val(TextBox5.Text)
costatt = Val(TextBox6.Text)
cat = ComboBox1.Text
dae1 = DateTimePicker1.Format = DateTimePickerFormat.Custom
DateTimePicker1.CustomFormat = "dd,MM,yy"
DateTimePicker1.Format = DateTimePickerFormat.Custom
dae2 = DateTimePicker2.Format = DateTimePickerFormat.Custom
DateTimePicker2.CustomFormat = "dd,MM,yy"
DateTimePicker2.Format = DateTimePickerFormat.Custom
Dim connetionString As String
Dim connection As SqlConnection
connetionString = "workstation id=RIKESH;packet size=4096;user id=sa;data source=RIKESH;persist security info=False;initial catalog=Merrymeetings"
connection = New SqlConnection(connetionString)
Dim sqlComm As New SqlCommand
Dim reader As SqlDataReader
sqlComm.Connection = connection
connection.Open()
sqlComm.CommandType = CommandType.StoredProcedure
sqlComm.CommandText = "valida"
sqlComm.Parameters.Add("@Venue_Name", SqlDbType.Char, 30).Value = ComboBox2.Text
sqlComm.Parameters("@Venue_Name").Direction = ParameterDirection.Input
sqlComm.Parameters.Add("@Start_Date", SqlDbType.NVarChar, 8).Value = DateTimePicker1.Text
sqlComm.Parameters("@Start_Date").Direction = ParameterDirection.Input
sqlComm.Parameters.Add("@End_Date", SqlDbType.NVarChar, 8).Value = DateTimePicker2.Text
sqlComm.Parameters("@End_Date").Direction = ParameterDirection.Input
sqlComm.Parameters.Add("@Venue_Rent", SqlDbType.NVarChar, 8)
sqlComm.Parameters("@Venue_Rent").Direction = ParameterDirection.Output
Try
reader = sqlComm.ExecuteReader()
If reader.Read Then
[color="#FF0000"]Skips this part[/color] MessageBox.Show(reader.Item(0) & " is booked from:" & reader.Item(1) & "Till-" & reader.Item(2) & "Rent" & reader.Item(3), "WHOOPS", MessageBoxButtons.OK, MessageBoxIcon.Information)
Button1.Hide()
ElseIf MessageBox.Show("Venue is available", "HOORAY!!!", MessageBoxButtons.OK, MessageBoxIcon.Information) Then
Button1.Show()
End If
Catch sqlex As SqlException
MessageBox.Show(sqlex.Message)
End Try
connection.Close()
I have come to a realization that a datareader and I are not friends
This post has been edited by modi123_1: 10 October 2012 - 07:05 AM
Reason for edit:: highlight the text and just click the 'code' button in the text editor

New Topic/Question
Reply




MultiQuote




|