Private Sub Command_Click()
Dim MyConnObj As New ADODB.Connection 'ADODB Connection Object
Dim myRecSet As New ADODB.Recordset 'Recordset Object
Dim sqlStr As String ' String variable to store sql command
MyConnObj.Open "Provider = sqloledb;" & "Data Source=JITENDRA-PC\SQLEXPRESS;" & "Initial Catalog=Test;"
sqlStr = "select * from Test"
myRecSet.Open sqlStr, MyConnObj, adOpenKeyset
MsgBox "Total Number of records = " & myRecSet.RecordCount
MyConnObj.Close
End Sub


Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 16, 2017, 2:11 AM EST
User Id=myUsername;Password=myPassword;
Integrated Security=SSPI;
Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 16, 2017, 12:24 AM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 16, 2017, 2:07 AM EST
Jitendra ShekhawatRank #1,909 · 772 reputationPosted Feb 16, 2017, 12:38 AM EST
Jitendra ShekhawatRank #1,909 · 772 reputationPosted Feb 16, 2017, 2:13 AM EST
invalid authorization specification
Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 16, 2017, 2:15 AM EST
Jitendra ShekhawatRank #1,909 · 772 reputationPosted Feb 16, 2017, 2:19 AM EST