The SQL command looks something like this:
Private Function storeData(ByVal mySql As String) As Boolean Dim ret As Boolean = False Dim ac As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & myPath) Try Using ac Dim myCommand = New System.Data.OleDb.OleDbCommand(mySql, ac) myCommand.Connection.Open() myCommand.ExecuteNonQuery() myCommand.Connection.Close() End Using ret = True Catch ex As Exception MsgBox("There is something wrong." & _ vbNewLine & ex.ToString, MsgBoxStyle.Exclamation, "SQL Error") End Try Return ret End Function
and seem to work fine, and when I browse through the table using my program after having entered a new record, I can see the new records. But when I close the program and reopens it, or query the DB from outside, the newly entered data have disappeared. What am I missing? Do I need som kind of file save or commit or something?
Insert into NAD(Name,Address,Postnumber,Telefonnumber,Epostaddress,Webpage) values('Thor','Oslo','0575','999 88 777','email@example.com','www.web.com');
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.