Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-02-10 : 07:50:53
|
| Majid-Vahedi writes "helloMy question is how can connect with Sql database in vb 6.0 (ado)and create recorde set?thank youhave a good time" |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2004-02-10 : 10:17:46
|
| [code]'Add Microsoft Data Access Object Library to references Dim cnn As ADODB.Connection Dim rs As ADODB.Recordset Dim strCnn, strSQL As String Set cnn = New ADODB.Connection strCnn = "Driver={SQL Server};Server=<YourDBServerName>;Database=<YourDBName>;UID=<UserName>;PWD=<Password>" cnn.Open strCnn Set rs = New ADODB.Recordset strSQL = "SELECT <columns> FROM <table>" rs.Open strSQL, cnn rs.MoveFirst While Not rs.EOF Debug.Print rs(" <column> ") rs.MoveNext Wend rs.Close cnn.Close Set rs = Nothing Set cnn = Nothing[/code] |
 |
|
|
|
|
|