TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dinesh Santhalingam
NA
737
368.4k
Insert Values to SQLTable from VBA
Mar 25 2018 10:43 PM
I need to insert a Values to the table in SQL Server from VBA .I tried Something I mentioned below .But I couldn't able to achieve my results .please guide me to solve this .I am using Exact Conn String in my Option even though its not functioning.
Sub To_SQL()
Dim conn As ADODB.Connection
Dim cmd As ADODB.Command
Dim strSQL As String
'Create a
new
Connection object
Set conn = New ADODB.Connection
'Set the connection string
conn .ConnectionString =
"Data Source=55.50.53.9;Initial Catalog=Management;Persist Security Info=True;User ID=licenceusr;Password=******"
'Open the Connection to the database
conn .Open **
conn .Execute
"insert into MyTableName (firstname, lastname) values('"
"Dhini"
"','"
"Dhini"
"')"
'Create a
new
Command object
Set cmd = New ADODB.Command
End Sub()
Thanks in advance.
Reply
Answers (
3
)
update,insert,delete query in a table
Transact-SQL(PARSE,TRY_PARSE,TRY_CONVERT)