Tc2037
04-13-02, 21:32
| Can someone give me generic code to connect to a database (SQL) via VB code? My forum is too cramped and I want to know how to do it through code anyways. ~~ Tc |
View Full Version : How do I connect to a Database via code?
| Can someone give me generic code to connect to a database (SQL) via VB code? My forum is too cramped and I want to know how to do it through code anyways. ~~ Tc |
| Well, Im using VB 6, and my m_dac version is 2.6. I was just thinking something along the lines of: dim rs as new ADORS.Recordset dim co as new ADORS.Command rs.open "SELECT * FROM MyTable WHERE [User] LIKE '%Test%'", "DNS=MyDatabase", adOpenKeySet, adLockOptimistic, adCmdTxt If rs.RecordCount = 0 Then MsgBox "Unable to find any users", vbCritical + vbOKOnly, "WARNING!" End If Would that work? |