hi,i want to insert booking_no as combination of year and sno(year/sno) into database here iam giving the code as follows,,,,,,,,,
here sno(serial number is automatically generated when page is loaded) started from 1.........
Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("guest1").ConnectionString())
Dim booking_no, sno As String
If Len(sno) = 1 Then
sno = "0000" + CStr(sno)
End If
If Len(sno) = 2 Then
sno = "000" + CStr(sno)
End If
If Len(sno) = 3 Then
sno = "00" + CStr(sno)
End If
If Len(sno) = 4 Then
sno = "0" + CStr(sno)
End If
If Len(sno) = 5 Then
sno = "" + CStr(sno)
End If
booking_no = CStr(year) & "/" & sno
conn.open()
Dim insert As New SqlClient.SqlCommand("insert into guesthouse(booking_no,sno) values('" & booking_no & "' ,'" & sno & "' ", conn)
insert.ExecuteNonQuery()
conn.close()
but here booking_no was not inserted properly,it was inserted as "0/ ",,
iwant to insert booking_no as "2010/sno" ,
,,,pls help me,urgent,,,,,,,