Solved

How to do a sql command ("Insert into ...") with ODBC

Posted on 1998-10-08
1
316 Views
Last Modified: 2012-05-04
Hi,

I want to do a direct sql command ("Insert into ...") with an ODBC connection.

I use vba excel (97) but i think it the same syntax in vb.

Thanks
0
Comment
Question by:didede
1 Comment
 

Accepted Solution

by:
mskannan earned 50 total points
Comment Utility
Hi didede,
I am giving you a simple code in VB to insert into a database

dim en as rdoenvironment
set en= rdoenvironments(0)
dim cn as rdoconnection
dim conn as string
conn$ = "DSN=temp;UID=sa;PWD=;DATABASE=emp;
set cn=en.openconnection("",rddrivernoprompt,false,conn$)
dim mysql as string;
mysql="Insert into employee values('James',26,'14/12/72');"
dim myQry as rdoquery
myqry.sql = mysql
myqry.execute
myqry.close
cn.close

Better try this one and feedback.
mskannan.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now