By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,626 Members | 1,424 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,626 IT Pros & Developers. It's quick & easy.

how to add data to database ?

P: 16
i dont want use insert sql query
got other way to do ?

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim cn As New ADODB.Connection
  3. Dim rs As New ADODB.Recordset
  4. Dim strCNString As String
  5.  
  6. strCNString = "Data Source=" & App.Path & "\final.mdb"
  7. cn.Provider = "Microsoft Jet 4.0 OLE DB Provider"
  8. cn.ConnectionString = strCNString
  9. cn.Open
  10.  
  11. Dim sql As String
  12.     sql = "SELECT sum(salary), name, gender FROM abc GROUP BY name, gender"
  13.     Set rs = cn.Execute(sql, , adCmdText)
  14.  
  15.       With rs
  16.  
  17.         .Fields("salary").Value = txtSalary.Text        
  18.         .Fields("name").Value = txtName.Text
  19.         .Fields("gender").Value = txtGender.Text
  20.  
  21.       End With
  22.  
  23.  
Apr 4 '07 #1
Share this Question
Share on Google+
1 Reply


Dököll
Expert 100+
P: 2,364
i dont want use insert sql query
got other way to do ?

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim cn As New ADODB.Connection
  3. Dim rs As New ADODB.Recordset
  4. Dim strCNString As String
  5.  
  6. strCNString = "Data Source=" & App.Path & "\final.mdb"
  7. cn.Provider = "Microsoft Jet 4.0 OLE DB Provider"
  8. cn.ConnectionString = strCNString
  9. cn.Open
  10.  
  11. Dim sql As String
  12.     sql = "SELECT sum(salary), name, gender FROM abc GROUP BY name, gender"
  13.     Set rs = cn.Execute(sql, , adCmdText)
  14.  
  15.       With rs
  16.  
  17.         .Fields("salary").Value = txtSalary.Text        
  18.         .Fields("name").Value = txtName.Text
  19.         .Fields("gender").Value = txtGender.Text
  20.  
  21.       End With
  22.  
  23.  
How do you mean? I am certain there are many ways to retrieve with minimal coding. I can't see how this can be achieved without writing actual SQL, especially if you are looking at grabbing data out of database columns, rows, and so on. Please continue to stay tuned, other, more qualified specialists here may know of some tricks that'll help you through...
Apr 4 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.