|
-
Feb 11th, 2003, 09:49 AM
#1
Thread Starter
Frenzied Member
db error
I'm getting this error when I hit this line objCommand.ExecuteNonQuery()
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
Code:
Dim sqlCmd As String = "insert into DBATEST.PCMS_Billing_Period (begin_billing_date,end_billing_date,credit_card_no,employee_work_unit,status_ind) "
sqlCmd = sqlCmd & "values (?,?,?,?,?)"
Dim objCommand As New OleDbCommand(sqlCmd, objConnection)
objCommand.Parameters.Add("@begin_billing_date", System.Data.OleDb.OleDbType.Date).Value = dp1.Value
objCommand.Parameters.Add("@end_billing_date", System.Data.OleDb.OleDbType.Date).Value = dp2.Value
objCommand.Parameters.Add("@credit_card_no", System.Data.OleDb.OleDbType.Char, 16).Value = txtCreditNo.Text
objCommand.Parameters.Add("@employee_work_unit", System.Data.OleDb.OleDbType.Char, 4).Value = txtWorkUnit.Text
objCommand.Parameters.Add("@status_ind", System.Data.OleDb.OleDbType.Char, 1).Value = Post_to_Int
objConnection.Open()
objCommand.ExecuteNonQuery()
objConnection.Close()
-
Feb 11th, 2003, 09:57 AM
#2
Fanatic Member
Just wondering....
Shouldn't the ?,?,?,? in command string be replaced with @end_billing_date, @credit_card_no, @employee_work_unit, @status_ind
Using VB.NET 2003/.NET 1.1/C# 2.0
http://del.icio.us/rajoo
Blow your mind, smoke gunpowder
Ashes to ashes, dust to dust
If God won't have you, the devil will. - Author unknown
Don't follow me, I'm lost too ...
-
Feb 11th, 2003, 09:59 AM
#3
Thread Starter
Frenzied Member
I've been using that code on other apps and it has been working fine...till now!
-
Feb 11th, 2003, 01:35 PM
#4
Sleep mode
try using your table name like this
VB Code:
[DBATEST.PCMS_Billing_Period]
usually , this error caused by connection strings , SQL string(misspelled table name ..)
-
Feb 11th, 2003, 01:38 PM
#5
Thread Starter
Frenzied Member
thanks guys...I put the DB connection in a Try, Catch block and got a more detailed error message...it was an inccorect table name..
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
|
Click Here to Expand Forum to Full Width
|