By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,593 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

Running sql-query

P: n/a
How do I run this query
Dim objConnectionUNI As OleDbConnection = New OleDbConnection(connUNI)
Dim objDataAdapter As OleDbDataAdapter = New OleDbDataAdapter( _
"INSERT INTO tblDebitor ( Kontonr, KontoNrTall, Kontnavn,
Adresse, Postnr, Poststed, " & _
"Land, SaliŚr, Salifjor ) " & _
"SELECT DEBITOR.Kontonr, DEBITOR.Kontonr, DEBITOR.Kontnavn,
DEBITOR.Adresse, DEBITOR.Postnr, " & _
"DEBITOR.Poststed, DEBITOR.Land, DEBITOR.SaliŚr,
DEBITOR.Salifjor " & _
"FROM DEBITOR " & _
"WHERE tblDebitor.Kontonr Not = DEBITOR.Kontonr", objConnection)

How do I run this query?

regards
reidarT
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Tue, 14 Jun 2005 14:19:09 +0200, "ReidarT" <re****@eivon.no> wrote:
How do I run this query
Dim objConnectionUNI As OleDbConnection = New OleDbConnection(connUNI)
Dim objDataAdapter As OleDbDataAdapter = New OleDbDataAdapter( _
"INSERT INTO tblDebitor ( Kontonr, KontoNrTall, Kontnavn,
Adresse, Postnr, Poststed, " & _
"Land, SaliŚr, Salifjor ) " & _
"SELECT DEBITOR.Kontonr, DEBITOR.Kontonr, DEBITOR.Kontnavn,
DEBITOR.Adresse, DEBITOR.Postnr, " & _
"DEBITOR.Poststed, DEBITOR.Land, DEBITOR.SaliŚr,
DEBITOR.Salifjor " & _
"FROM DEBITOR " & _
"WHERE tblDebitor.Kontonr Not = DEBITOR.Kontonr", objConnection)

How do I run this query?


The way I would run it:

dim cn as sqlconnection
dim cmd as sqlcommand
dim sSQL as string

sSQL = "INSERT INTO tblDebitor ( Kontonr, KontoNrTall, Kontnavn," &_
"Adresse, Postnr, Poststed, " & _
"Land, SaliŚr, Salifjor ) " & _
"SELECT DEBITOR.Kontonr, DEBITOR.Kontonr, EBITOR.Kontnavn,
DEBITOR.Adresse, DEBITOR.Postnr, " & _
"DEBITOR.Poststed, DEBITOR.Land, DEBITOR.SaliŚr,
DEBITOR.Salifjor " & _
"FROM DEBITOR " & _
"WHERE tblDebitor.Kontonr Not = DEBITOR.Kontonr"
cn = new sqlconnection("appropriate connection string")
cmd = new sqlcommand(sSQL, cn)
cmd.executenonquery()
cmd.dispose
cn.close
cn.dispose
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.