VB.NET with MS access data type dismatch

Tags:
Microsoft Access
VB.NET
provider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" datafile = "D:weighmentweighment.accdb" connstring = provider & datafile myConnection.ConnectionString = connstring myConnection.Open() Dim str As String str = "Insert into WeighingData ([TruckNo],[GatePassNo],[Shift],[FirstDate],[Firsttime],[CustomerID],[SupplierID],[ItemCode],[FirstWeight],[Source_DEstinationID]) values (?,?,?,?,?,?,?,?,?,?)" Dim cmd As OleDbCommand = New OleDbCommand(str, myConnection) cmd.Parameters.Add(New OleDbParameter("TruckNo", CType(TextBox1.Text, String))) cmd.Parameters.Add(New OleDbParameter("CustomerID", CType(TextBox13.Text, String))) cmd.Parameters.Add(New OleDbParameter("SupplierID", CType(TextBox14.Text, String))) cmd.Parameters.Add(New OleDbParameter("GatePassNo", CType(TextBox3.Text, String))) cmd.Parameters.Add(New OleDbParameter("ItemCode", CType(TextBox15.Text, Integer))) cmd.Parameters.Add(New OleDbParameter("Source_DestinationID", CType(TextBox16.Text, String))) cmd.Parameters.Add(New OleDbParameter("Shift", CType(TextBox5.Text, String))) cmd.Parameters.Add(New OleDbParameter("FirstDate", CType(TextBox6.Text, Date))) cmd.Parameters.Add(New OleDbParameter("FirstTime", CType(TextBox7.Text, DateTime))) cmd.Parameters.Add(New OleDbParameter("FirstWeight", CType(TextBox8.Text, Integer))) cmd.Parameters.Add(New OleDbParameter("Operator", CType(TextBox4.Text, String))) cmd.Parameters.Add(New OleDbParameter("Intern_Extern", CType(TextBox18.Text, String))) Try cmd.ExecuteNonQuery() cmd.Dispose() myConnection.Close() Catch ex As Exception MsgBox(ex.Message) End Try Me.WeighingDataTableAdapter.Fill(Me.WeighmentDataSet.WeighingData) Me.WeighingDataTableAdapter.FillBy11(Me.WeighmentDataSet.WeighingData) ElseIf ((RadioButton1.Checked = True) And (RadioButton3.Checked = True)) Then provider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" datafile = "D:weighmentweighment.accdb" connstring = provider & datafile myConnection.ConnectionString = connstring myConnection.Open() Dim str As String str = "update [Internal_Vehicle] set [TareDate] = " & TextBox6.Text & ", [TareTime] = '" & TextBox7.Text & "' , [TareWt] = " & TextBox8.Text & " , [Shift] = " & TextBox5.Text & " where [VehicleNo] = " & TextBox1.Text & "" Dim cmd As OleDbCommand = New OleDbCommand(str, myConnection) Try cmd.ExecuteNonQuery() cmd.Dispose() myConnection.Close() Catch ex As Exception MsgBox(ex.Message) End Try


Software/Hardware used:
vb.net with oledb data time mismatch
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    How are the columns defined in your database table? Are they all VARCHAR?
    133,645 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: