A ver señores toy intentando conectar desde vb a un servidor sql, este es el codigo q esta mal?¿ xDD
Public Function EstableceConexion()
Dim ob As ADODB.Connection
Dim strCnn As String
strCnn = "Provider=SQLOLEDB.1;" & _
"Data Source=DMR - SLQ7;Initial Catalog=BdManIn;User Id=david;Password=david;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096"
On Error GoTo Error
Set ob = New ADODB.Connection
ob.Open strCnn
' With ob
' .Open "DRIVER={SQL Server};SERVER=DMR - SLQ7;DATABASE=BdManIn;UID=sa"
'
'' .Provider = "sqloledb"
' .Properties("Data Source").Value = "DMR - SLQ7"
'' .Properties("Initial Catalog").Value = "BdManIn"
'' .Properties("User id").Value = "sa"
'' .Properties("Password") = ""
'' .Open
'
' '.Provider = "sqloledb"
' '.Open "Data Source=DMR-SLQ7;Initial Catalog=BdManIn;", "sa", ""
' End With
Error:
MsgBox ("No")
End Function
asias