sql server - vb.net SQL date to time conversion issue -


error is:. Conversion failed when changing date and / or time from character string

Actually I'm trying to make it so that when someone clicks on a location in a list box, this figure is correct with 1 in the table. The field increases so that they can click on the location. I'm trying to solve it for a while and can not find anywhere. My date is in date format, and so on my statistics table has a date field. My code can be seen below. String Dim Check String as String ObjCmd2 Object dim as iCount integer dim tDate as current current as dirty current = LocBox.SelectedItem check = LocList.FindString (Current) if check & gt; -1 Then the MsgBox ("you have already selected this place to travel") or else LocList.Items.Add (current) ObjDataReader.Close () tDate = Date.Today MessageBox.Show (tDate) tDate = tDate .toString () objCmd2 = New SqlCommand ("select" & replace (current, "", "_") & "where data from date = to" "& amp; tDate & amp; ObjConn ObjDataReader = objCmd2.ExecuteReader ObjDataReader.HasRows then ObjDataReader.Read () if ObjDataReader (0) is DBNull.Value then iCount = 0 otherwise iCount = ObjDataReader (0) ends if else iCount = 0 end then objCmd = New SqlCommand ("INSERT INTO Statistics (Date," & Change (current, "", "_") & amp; ") value ('' & amp; tDate.Date & amp;" ', & amp; Mp; iCount & amp; "), objConn ObjDataReader.Close (objCmd.ExecuteNonQuery) Thanks in advance objConn.

This issue comes with another SQL statement which I think. I'm not going to have an issue to add a date to a date field, I tried to add it as a string that did not work. Thanks so far for all the answers.

I think this issue is here: Show the message box (TDT)

TDT to you date Using toasting, you need to convert to a string or another method you want.

Are you compiling errors? I always code the option with strict on, and your code will definitely bring errors where you are not changing the variable.

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -