chokka
asked on
ExecuteNonQuery() MS Access
VS 2005 / VB.Net
Simple Insert Query.
Using Execute Non Query -
I am not able to insert a simple query.
Table has only two columns ( StatesId which is AutoNumber and StateShortName which is Text DataType ).
Dim myOleCommand As OleDbCommand
Dim myConn As New OleDbConnection("C:\Enrollment Form\EnrollmentApp\EnrollmentApp\EnrollmentDB.mdb")
myConn.Open()
Dim strCommand As String
strCommand = "Insert into tmpStates (StateShortName) values('Chokka')"
myOleCommand = New OleDbCommand(strCommand, myConn)
myOleCommand.ExecuteNonQuery()
myConn.Close()
ASKER
No, I am not getting any errors
ASKER
I am not getting any errors and Insertion is not happeing ..
ASKER
Once i closed the app and opened again, i am getting errors as follows
{"Format of the initialization string does not conform to specification starting at index 0."}
{"Format of the initialization string does not conform to specification starting at index 0."}
{"Format of the initialization string does not conform to specification starting at index 0."}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Dhaest:
It works ..!
Now, i need to move this connection string to App.Config file ..!
It works ..!
Now, i need to move this connection string to App.Config file ..!
try
myConn.Open()
Dim strCommand As String
strCommand = "Insert into tmpStates (StateShortName) values('Chokka')"
myOleCommand = New OleDbCommand(strCommand, myConn)
myOleCommand.ExecuteNonQue
myConn.Close()
catch ex as Exception
end try