Dim txt1 As String, txt2 As String
'Set txtSampleTextBox = Controls.Add("Forms.TextBox.1", "txtSampleTB")
Set rst = CreateObject("adodb.recordset")
server_name = "192.168.1.200"
Database_Name = "empdetails" ' Enter your database name here
User_id = "root" ' enter your user ID here
Password = "bmx1" ' Enter your password here
source1 = "emp"
Set conn = New ADODB.Connection
Set rst = New ADODB.Recordset
conn.ConnectionString = "DRIVER={MySQL ODBC 5.2 unicode Driver};SERVER=" & server_name & ";UID=" & User_id & ";PWD=" & Password & ";DATABASE=" & Database_Name & "; Source=" & source1 & ";"
conn.Open
Dim c As ADODB.Connection
Dim r As ADODB.Recordset
Set c = New ADODB.Connection
Dim rw As Integer
c.Open "DSN=emp"
sq = "Insert into userinfo (employeename,systemname,logindate,logintime, team lead by, project name, allocated work) values ('" & employeename.Value & "','" & systemname.Value & "','" & logindate.Value & "','" & logintime.Value & "','" & TextBox1.Value & "','" & TextBox2.Value & "','" & TextBox3.Value & "')" -->getting error in this line
Set r = c.Execute(sq)
c.Close
conn.Close
Unload Me
MsgBox "Database Updated!", vbOKOnly, "Update!"
please help me i am trying to insert data from the userform to mysql database
Bookmarks