My problem is the command composed of SQLC String
The logic is following:
1. If exists Table tblETYKIETA - delete Table tblETYKIETA
2. Create tblETYKIETA
3. Append data to tblETYKIETA
The case is that when I run the source query in MS Access the query
appends records to tblETYKIETA.
However when I try to trigger from VB.Net, tblETYKIETA does not gets
the records.
The case is that when the INSERT Query string is coppied from VB.NET
to MS Access it
does the trick.
I have suspicion that the composition of the query from VB.Net must be
different than
one in ACCESS.
The part of the code is following:
SchemaTable =
myConnection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Columns,
New Object() {Nothing, Nothing, "tblETYKIETA"})
If SchemaTable.Rows.Count <> 0 Then
Console.WriteLine("Tabla " & SchemaTable.Rows(0)!TABLE_NAME.ToString &
" istnieje")
dbCommand1 = New OleDbCommand(mySQLA, myConnection)
dbCommand1.CommandType = CommandType.Text
dbCommand1.ExecuteNonQuery()
Else
Console.WriteLine("Tabla " & SchemaTable.Rows(0)!TABLE_NAME.ToString &
" nie istnieje")
End If
dbCommand2 = New OleDbCommand(mySQLB, myConnection)
dbCommand2.CommandType = CommandType.Text
dbCommand2.ExecuteNonQuery()
myTrans = myConnection.BeginTransaction
dbCommand3 = New OleDbCommand(mySQLC, myConnection, myTrans)
dbCommand3.CommandType = CommandType.Text
dbCommand3.ExecuteNonQuery()
myTrans.Commit()
...
SQLC String is following:
I suspect that the synthax of such string must be different when run
from VB.Net
mySQLC = "INSERT INTO tblETYKIETA ( NODOW, NPOZ, INDEKS, INAZWA,
WOPRE, WSF, JM, KOD30 ) " & _
"SELECT qryWOM_WZ_DANE_UNIA.NODOW, CStr([NOPOZ]) AS NPOZ,
qryWOM_WZ_DANE_UNIA.INDEKS,
IIf(qryWOM_WZ_DANE_UNIA.INDEKS=""65045"",qryZPData.REMARK01,[INAZWA])
AS NAZWAI, qryWOM_WZ_DANE_UNIA.WOPRE, CStr(qryWOM_WZ_DANE_UNIA.WOSUF)
AS WSF, qryWOM_WZ_DANE_UNIA.JM,
IIf(qryWOM_WZ_DANE_UNIA.INDEKS=""65045"",qryZPData.REMARK02,[KOD30])
AS KodObcy, _
"FROM mg00imwo INNER JOIN (((qryWOM_WZ_DANE_UNIA LEFT JOIN
qryKID_WOM_UNIA ON qryWOM_WZ_DANE_UNIA.INDEKS =
qryKID_WOM_UNIA.INDEKS) LEFT JOIN qryZPData ON
(qryWOM_WZ_DANE_UNIA.WOSUF = qryZPData.WOSUF) AND
(qryWOM_WZ_DANE_UNIA.WOPRE = qryZPData.WOPRE)) LEFT JOIN qryZamSp ON
(qryWOM_WZ_DANE_UNIA.ZANUMPOZ = qryZamSp.NUM_POZ) AND
(qryWOM_WZ_DANE_UNIA.ZANUMER = qryZamSp.NUMER)) ON mg00imwo.INDEKS =
qryWOM_WZ_DANE_UNIA.INDEKS " & _
"ORDER BY qryWOM_WZ_DANE_UNIA.NODOW, CStr([NOPOZ]);"
Looking forward to any hints!
MF
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net