Re: Running sql-query
- From: Joe Cool <joecool@xxxxxxxx>
- Date: Tue, 14 Jun 2005 15:02:45 GMT
On Tue, 14 Jun 2005 14:19:09 +0200, "ReidarT" <reidar@xxxxxxxx> 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
.
- References:
- Running sql-query
- From: ReidarT
- Running sql-query
- Prev by Date: extra line drawn to blob
- Next by Date: Confusion about interface
- Previous by thread: Running sql-query
- Next by thread: Help - How to join two datasets
- Index(es):
Relevant Pages
|