-
'input string was not in correct format'
Hi,
d1 is date
bID is integer
Whats wrong with following sql statement while concatnetion
strSQL = "Insert into sessiondelayed (batchid,ActualEndDate) values (" & bID & ",'" & d1 & "')"
This is throwing error that 'input string was not in correct format'
Swati
Last edited by b_swati; 07-12-2006 at 04:47 AM.
Reason: statements missing
-
 Originally Posted by b_swati
strSQL = "Insert into sessiondelayed (batchid,ActualEndDate) values (" & bID & ",'" & d1 & "')"
This is throwing error that 'input string was not in correct format'
Swati
Hi Swati,
I guess that one of the value of variables (bID or d1) is missing in your coding.
Let me tell you one useful way to debug the SQL Statement..
1) Set the breakpoint on the line.
2) Run the project.
3) Check the value of the varibale "strSQL" after the debugging line has passed to the next line.
eg: maybe. you might see like ."Insert into sessiondelayed (batchid,ActualEndDate) values (1,'aa')"
Note: ensure that the value of "bID" and "d1" are shown in the string.
4) Then copy this value..
5) Paste it in the SQL Query Analyzer (if you are using SQL db).
6) then, Execute this string which is pasted in Query.
Note: You will see the reason why your statement is faild to execute.
P.S: If you still dont know what the problem is, please post the value of "strSQL" statement (Step 3) after debugging.
Hope you may find it useful..
-
If I had to take guess, I would say that since you're using a string variable for your Date it probably isn't in the format expected by the database.
Paul
~~~~
Microsoft MVP (Visual Basic)
-
I'm with Paul on this one.
Try outputting the strSQL variable after you have it built. Copy that and run it in Query Analyzer (or a similar tool) and see if the insert works.
If it doesn't, then you found your problem.
Similar Threads
-
By Marcos in forum VB Classic
Replies: 3
Last Post: 01-25-2006, 12:18 PM
-
By kenn_rosie in forum .NET
Replies: 2
Last Post: 01-11-2006, 10:28 AM
-
By naijacoder in forum ASP.NET
Replies: 6
Last Post: 11-10-2005, 03:54 AM
-
By ewarmour in forum ASP.NET
Replies: 0
Last Post: 03-27-2003, 02:36 PM
-
By mdengler in forum ASP.NET
Replies: 0
Last Post: 11-26-2002, 03:32 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|