OleDbCommandBuilder Isnt Building...

  • Thread starter Thread starter Robby.White
  • Start date Start date
R

Robby.White

I am trying to write to a text file using JET and
ADO.NET, however I am getting the "syntax error in insert
into statement" even though my column names are all
original. I think the problem is with the
OleDbCommandBuilder as when I build an INSERT statement
for the OleDbCommand manually it writes successfully to
the text file. Is this a known problem? Here are my
details;

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents
and Settings\Administrator\My Documents\Visual Studio
Projects\Aurora\bin\Data\;Extended
Properties=Text;Persist Security Info=False

[Body for Tesco Events.prn]
Format=FixedLength
Col1=Event Text Width 6
Col2=Junk Text Width 2
Col3=Description Text Width 29
Col4=Type Text Width 1

Thanks, Robby
 
Robby, a CommandBuilder needs a Primary Key to work and AFAIK, using text as
a source or Excel for instance won't do it for you.
 
Try something like this (don't have my code right in front of me, so this
might not be 100% accurate):

Dim aPK(1) As Object ' example of two column Primary Key
aPK(0) = "F1"
aPK(1) = "F2"
ds.PrimaryKey = aPK ' not sure if this line is correct, but it's pretty
close

' Do all of the above prior to invoking Fill method.
 
I have tried adding a primary key after the fill and then
creating the command builder but this did not work. Does
this mean ADO.NET cannot write to text files using Jet?
This cannot be? By the way what does AFAIK mean?
-----Original Message-----
Robby, a CommandBuilder needs a Primary Key to work and AFAIK, using text as
a source or Excel for instance won't do it for you.
"(e-mail address removed)"
message news:[email protected]...
I am trying to write to a text file using JET and
ADO.NET, however I am getting the "syntax error in insert
into statement" even though my column names are all
original. I think the problem is with the
OleDbCommandBuilder as when I build an INSERT statement
for the OleDbCommand manually it writes successfully to
the text file. Is this a known problem? Here are my
details;

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents
and Settings\Administrator\My Documents\Visual Studio
Projects\Aurora\bin\Data\;Extended
Properties=Text;Persist Security Info=False

[Body for Tesco Events.prn]
Format=FixedLength
Col1=Event Text Width 6
Col2=Junk Text Width 2
Col3=Description Text Width 29
Col4=Type Text Width 1

Thanks, Robby


.
 
I have tried adding a primary key but can only do it
after the fill as it needs appended to the table not the
dataset, i then created the command builder but this did
not work.
-----Original Message-----
Robby, a CommandBuilder needs a Primary Key to work and AFAIK, using text as
a source or Excel for instance won't do it for you.
"(e-mail address removed)"
message news:[email protected]...
I am trying to write to a text file using JET and
ADO.NET, however I am getting the "syntax error in insert
into statement" even though my column names are all
original. I think the problem is with the
OleDbCommandBuilder as when I build an INSERT statement
for the OleDbCommand manually it writes successfully to
the text file. Is this a known problem? Here are my
details;

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents
and Settings\Administrator\My Documents\Visual Studio
Projects\Aurora\bin\Data\;Extended
Properties=Text;Persist Security Info=False

[Body for Tesco Events.prn]
Format=FixedLength
Col1=Event Text Width 6
Col2=Junk Text Width 2
Col3=Description Text Width 29
Col4=Type Text Width 1

Thanks, Robby


.
 
As Far as I Know
Robby White said:
I have tried adding a primary key after the fill and then
creating the command builder but this did not work. Does
this mean ADO.NET cannot write to text files using Jet?
This cannot be? By the way what does AFAIK mean?
-----Original Message-----
Robby, a CommandBuilder needs a Primary Key to work and AFAIK, using text as
a source or Excel for instance won't do it for you.
"(e-mail address removed)"
message news:[email protected]...
I am trying to write to a text file using JET and
ADO.NET, however I am getting the "syntax error in insert
into statement" even though my column names are all
original. I think the problem is with the
OleDbCommandBuilder as when I build an INSERT statement
for the OleDbCommand manually it writes successfully to
the text file. Is this a known problem? Here are my
details;

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents
and Settings\Administrator\My Documents\Visual Studio
Projects\Aurora\bin\Data\;Extended
Properties=Text;Persist Security Info=False

[Body for Tesco Events.prn]
Format=FixedLength
Col1=Event Text Width 6
Col2=Junk Text Width 2
Col3=Description Text Width 29
Col4=Type Text Width 1

Thanks, Robby


.
 
Ive just written to the text file using ADODB
within .NET, however I would rather not. Can you point
me to the MS source thats states ADO.NET cant write to
text files... there must be a workaround... help! What is
AFAIK?
-----Original Message-----
As Far as I Know
Robby White said:
I have tried adding a primary key after the fill and then
creating the command builder but this did not work. Does
this mean ADO.NET cannot write to text files using Jet?
This cannot be? By the way what does AFAIK mean?
-----Original Message-----
Robby, a CommandBuilder needs a Primary Key to work
and
AFAIK, using text as
a source or Excel for instance won't do it for you.
"(e-mail address removed)"
message I am trying to write to a text file using JET and
ADO.NET, however I am getting the "syntax error in insert
into statement" even though my column names are all
original. I think the problem is with the
OleDbCommandBuilder as when I build an INSERT statement
for the OleDbCommand manually it writes successfully to
the text file. Is this a known problem? Here are my
details;

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents
and Settings\Administrator\My Documents\Visual Studio
Projects\Aurora\bin\Data\;Extended
Properties=Text;Persist Security Info=False

[Body for Tesco Events.prn]
Format=FixedLength
Col1=Event Text Width 6
Col2=Junk Text Width 2
Col3=Description Text Width 29
Col4=Type Text Width 1

Thanks, Robby



.


.
 
AFAIK = As Far as I Know

Robby said:
Ive just written to the text file using ADODB
within .NET, however I would rather not. Can you point
me to the MS source thats states ADO.NET cant write to
text files... there must be a workaround... help! What is
AFAIK?
-----Original Message-----
As Far as I Know
Robby White said:
I have tried adding a primary key after the fill and then
creating the command builder but this did not work. Does
this mean ADO.NET cannot write to text files using Jet?
This cannot be? By the way what does AFAIK mean?

-----Original Message-----
Robby, a CommandBuilder needs a Primary Key to work and
AFAIK, using text as
a source or Excel for instance won't do it for you.
"(e-mail address removed)"
message I am trying to write to a text file using JET and
ADO.NET, however I am getting the "syntax error in
insert
into statement" even though my column names are all
original. I think the problem is with the
OleDbCommandBuilder as when I build an INSERT statement
for the OleDbCommand manually it writes successfully to
the text file. Is this a known problem? Here are my
details;

Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Documents
and Settings\Administrator\My Documents\Visual Studio
Projects\Aurora\bin\Data\;Extended
Properties=Text;Persist Security Info=False

[Body for Tesco Events.prn]
Format=FixedLength
Col1=Event Text Width 6
Col2=Junk Text Width 2
Col3=Description Text Width 29
Col4=Type Text Width 1

Thanks, Robby



.


.
 
Back
Top