djc
Advanced Member level 1
- Joined
- Jan 27, 2013
- Messages
- 402
- Helped
- 3
- Reputation
- 6
- Reaction score
- 2
- Trophy points
- 1,298
- Location
- India
- Activity points
- 4,554
hi,
i am working on a log in form in VB6. For that i have created a database in ms access. I made all the settings and it is saying that connection tested successfully. Still i am unable to insert the daata in the database. Constant error is there. I am not getting how to insert the data in data base. Here is the code
Pleasse guide
i am working on a log in form in VB6. For that i have created a database in ms access. I made all the settings and it is saying that connection tested successfully. Still i am unable to insert the daata in the database. Constant error is there. I am not getting how to insert the data in data base. Here is the code
Code Visual Basic - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 Option Explicit Public CON As adodb.Connection Public CMD As adodb.Command Public rs As adodb.Recordset Dim mstrSQL As String Public Sub ConnectToDB() Dim conString As String conString = "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source=D:\DH_VB6\db2.mdb" _ '& App.Path & "D:\DH_VB6\db2.mdb" Set CON = New adodb.Connection With CON .ConnectionString = conString .Open End With 'MsgBox "hw r u" End Sub Public Sub DisconnectFromDB() Set CMD = Nothing CON.Close Set CON = Nothing End Sub Private Sub Form_Load() ConnectToDB End Sub Private Sub Command1_Click() Set rs = New adodb.Recordset mstrSQL = "Insert into Usr_Pwd (Username,password) Values ('" & Text1.Text & "', '" & Text2.Text & "')" Set rs = CON.Execute(mstrSQL) /////////////Syntax error in Insert into command//////////// DisconnectFromDB MsgBox "i m fine" End Sub
Pleasse guide
Last edited by a moderator: