SQL UPDATE Error

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2007
Posts: 26
Reputation: ViRiPuFF is an unknown quantity at this point 
Solved Threads: 0
ViRiPuFF ViRiPuFF is offline Offline
Light Poster

SQL UPDATE Error

 
0
  #1
Jul 15th, 2007
Hi

I have the following code which generates an error 'Data Type mismatch in criteria expression'

The purpose of the code is to write a value to a database at a specific row.

  1.  
  2. Dim IntSid As String
  3. Dim Sid As String
  4. Dim I As Integer
  5.  
  6. IntSid = Me.TTIn.Text
  7. Sid = Me.SessionIDTextBox.Text
  8. I = CInt(Val(Sid))
  9.  
  10.  
  11. Dim loSQL = "UPDATE tblSession SET TTout = '" & _
  12. IntSid & "' WHERE SessionId = '" & _
  13. I & " ' "
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 1,849
Reputation: sk8ndestroy14 is an unknown quantity at this point 
Solved Threads: 1
sk8ndestroy14's Avatar
sk8ndestroy14 sk8ndestroy14 is offline Offline
Posting Virtuoso

Re: SQL UPDATE Error

 
0
  #2
Jul 16th, 2007
It looks like you never declared the datatype of loSQL.
Disclaimer: Nothing I say can be considered credible information (I wonder what that means about this disclaimer then).
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 26
Reputation: ViRiPuFF is an unknown quantity at this point 
Solved Threads: 0
ViRiPuFF ViRiPuFF is offline Offline
Light Poster

Re: SQL UPDATE Error

 
0
  #3
Jul 16th, 2007
Originally Posted by sk8ndestroy14 View Post
It looks like you never declared the datatype of loSQL.
Hi

I got it to work the problem was the single quote around the variable I which is an Integer and not a String

My original SQL statement was

  1. Dim loSQL = "UPDATE tblSession SET TTout = '" & _
  2. IntSid & "' WHERE SessionId = '" & _
  3. I & " ' "

This should have been


  1. Dim loSQL = "UPDATE tblSession SET TTout = '" & _
  2. Me.TTIn.Text & "'WHERE SessionId = " & _
  3. I & " "

ViRi
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,093
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 125
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: SQL UPDATE Error

 
1
  #4
Jul 19th, 2007
thanx for self learning, that really helps a lot.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC