0

hi iam getting error like "Conversion from string "0/" to type 'Double' is not valid." in the underline part of the coding ..........
here iam using sqlserver-2005

here my coding is

Protected Sub save_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles save.Click
 Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("guest1").ConnectionString())
        Dim booking_no, year, room_no, no_beds, amt, sino As Integer
        Dim date_of_arr, name, desig, dept, addr, date_of_dept, remarks, booked_by, booking_date As String
        Dim dt As Date
        dt = Date.Today

        If Len(sino) = 1 Then
            sino = "0000" + CStr(sino)
        End If
        If Len(sino) = 2 Then
            sino = "000" + CStr(sino)
        End If
        If Len(sino) = 3 Then
            sino = "00" + CStr(sino)
        End If
        If Len(sino) = 4 Then
            sino = "0" + CStr(sino)
        End If
      [U]  booking_no = CStr(year) + "/" + sino[/U]
 conn.Open()
        sino = sno.Text
        date_of_arr = dateofarrival.Text
        name = bookingname.Text
        desig = designation.Text
        dept = department.Text
        addr = address.Text
        room_no = roomno.Text
        no_beds = noofbeds.Text
        date_of_dept = dateofdeparture.Text
        remarks = purpose.Text
        booked_by = requestedby.Text
        booking_date = dateofbooking.Text
        Dim insert As New SqlClient.SqlCommand("insert into guesthouse(booking_no,date_of_arr,year,name,desig,dept,addr,room_no,no_beds,date_of_dept,amt,remarks,booked_by,booking_date,sino) values('" & booking_no & "' ,CONVERT(datetime,'" & date_of_arr & "',101),'" & dt.Year.ToString & "','" & name & "','" & desig & "','" & dept & "' ,'" & addr & "', '" & room_no & "','" & no_beds & "',CONVERT(datetime,'" & date_of_dept & "',101),'" & amt & "','" & remarks & "','" & booked_by & "',CONVERT(datetime,'" & booking_date & "',101),'" & sino & "')", conn)
        insert.ExecuteNonQuery()
        conn.Close()
        MsgBox("record saved")
    End Sub

pls give me the proper coding

Edited by kanuri1: n/a

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by __avd
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.