Good Day,
I am new with VB.Net 2005. I am trying to write some data into ms access. I have quite alot of problems trying to do that. However I found that it is because I cannot send characters into ms access. my code as follow,
note: if I change the 'a' to 'anynumber', the update will be successful
------------------------------------------------------
Imports System.Data.OleDb
Public Class Form1
Inherits System.Windows.Forms.Form
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim str As String
Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Wilfred\Desktop\UnitProdn\UnitProdn.mdb;")
cn.Open()
str = "insert into [tbl_UnitProdn-ProductInformation] (LotNo,ModelName,Qty) values (" & "a" & "," & "2" & "," & "3" & ")"
cmd = New OleDbCommand(str, cn)
cmd.ExecuteNonQuery()
MessageBox.Show("DataEntered")
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
cn.Close()
End Sub
End Class
------------------------------------------------------
pls help...![Stick out tongue :p :p](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
I am new with VB.Net 2005. I am trying to write some data into ms access. I have quite alot of problems trying to do that. However I found that it is because I cannot send characters into ms access. my code as follow,
note: if I change the 'a' to 'anynumber', the update will be successful
------------------------------------------------------
Imports System.Data.OleDb
Public Class Form1
Inherits System.Windows.Forms.Form
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim str As String
Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Wilfred\Desktop\UnitProdn\UnitProdn.mdb;")
cn.Open()
str = "insert into [tbl_UnitProdn-ProductInformation] (LotNo,ModelName,Qty) values (" & "a" & "," & "2" & "," & "3" & ")"
cmd = New OleDbCommand(str, cn)
cmd.ExecuteNonQuery()
MessageBox.Show("DataEntered")
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
cn.Close()
End Sub
End Class
------------------------------------------------------
pls help...