Error when running a sproc

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I am trying to run a sproc that retrieves a single booking number from my database
However i keep getting the following message and the booking No is not displayed
Can anyone tell me how to fix this?

system.InvalidCastExceptio
Specified cast is not valid

here is my code i used

Dim cmdNewBookingNo As New SqlCommand("SPSelMaxBookingNo+1", Cn
cmdNewBookingNo.CommandType = CommandType.StoredProcedur

Tr
Cn.Open(
Dim reader As SqlDataReade
reader = cmdNewBookingNo.ExecuteReader(
While reader.Rea
Dim BookingNo As SqlString = reader.GetSqlString(0
lblBookingNo.Text = BookingNo.ToStrin
End Whil
Catch ex As Exceptio
MsgBox(ex.Message, , ex.GetType.ToString
Finall
Cn.Close(
End Try
 
have you tried declaring BookingNo as a string?

PS - Crummy proc name. You should avoid characters other than "_" in your
naming convention.

Bob Lehmann
 
Hi Bob

I tried declaring BookingNo as a string as well but this did not work
I get the same error message

I also change dthe name of th sproc. I gotta admit it was a bad name :O

this is what i tried...
Dim BookingNo As String = reader.GetSqlString(0).ToStrin

do u hav any more suggestions i could try.
 
Back
Top