X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Insert Into SQL Server, Any Version    
post Aug 14 2019, 04:06 PM

Posts: 1,121
Joined: 19-February 08

Hello Friends

I use this code to insert or update record into SQL but not error appear and no record inserted or updated
what is the reason

Thank you

Private Sub Command0_Click()
Dim adoConn As New ADODB.Connection
'Trusted_Connection = Yes; if you use windows login if you want remove it add ' UID = addd ' Pwd= sdddsd
adoConn.ConnectionString = "Provider=SQLNCLI10; Server=DESKTOP-SEV77GF\SQLSERVER_ZEZO;Database =xx;Trusted_Connection=yes;"
If adoConn.State = 1 Then
Dim com As New ADODB.Command
Dim recordAffecteds As Long
com.ActiveConnection = adoConn
com.CommandType = adCmdText
'com.CommandText = "insert into Contacts (ContactName)Values ('abca')"
com.CommandText = "update Contacts set ContactName='abc'"
MsgBox recordAffecteds
End If

End Sub

This post has been edited by access2009eg: Aug 14 2019, 04:06 PM

I would like to Thank you for your help
Go to the top of the page

Posts in this topic

Custom Search

RSSSearch   Top   Lo-Fi    20th September 2019 - 11:19 AM