Home All Groups Group Topic Archive Search About

Can anyone See where I'm going wrong?

Author
14 Jul 2006 4:56 PM
MikeY
Hi Everyone,

Can anyone see where I'm going wrong? Win [C#]

OleDbConnection thisConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\HOST
017.MDB");

thisConnection.Open();

OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * from
TableTemplate", thisConnection);

OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(thisAdapter);

DataSet thisDataSet = new DataSet();



thisAdapter.Fill(thisDataSet,"TableTemplate");



MessageBox.Show("Before Change:" +
thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"]);



thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"] = "100";

thisAdapter.Update(thisDataSet, "TableTemplate");



MessageBox.Show("After Change: " +
thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"]);





Error being generated is : Syntax error(missing operator) in query
expression "((ID = ?) and ((? IS NULL AND Nam IS NULL) or (NAME = ?) AND....



It keeps ong on from there. But any and all help would be appreciated.



Thanks

MikeY

Author
14 Jul 2006 7:23 PM
Mark
Just a guess but the Rows collection is zero based so the first row is
Row[0]

--
Best regards
Mark Baldwin

Show quote
"MikeY" <mikesi***@yaho.com> wrote in message
news:OSNGsZ2pGHA.4196@TK2MSFTNGP04.phx.gbl...
> Hi Everyone,
>
> Can anyone see where I'm going wrong? Win [C#]
>
> OleDbConnection thisConnection = new
> OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\HOST
> 017.MDB");
>
> thisConnection.Open();
>
> OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * from
> TableTemplate", thisConnection);
>
> OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(thisAdapter);
>
> DataSet thisDataSet = new DataSet();
>
>
>
> thisAdapter.Fill(thisDataSet,"TableTemplate");
>
>
>
> MessageBox.Show("Before Change:" +
> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"]);
>
>
>
> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"] = "100";
>
> thisAdapter.Update(thisDataSet, "TableTemplate");
>
>
>
> MessageBox.Show("After Change: " +
> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"]);
>
>
>
>
>
> Error being generated is : Syntax error(missing operator) in query
> expression "((ID = ?) and ((? IS NULL AND Nam IS NULL) or (NAME = ?)
> AND....
>
>
>
> It keeps ong on from there. But any and all help would be appreciated.
>
>
>
> Thanks
>
> MikeY
>
>
Author
14 Jul 2006 11:07 PM
Jim Hughes
Name is a reserved word and should not be used for table or column names.

Do you have a primary key defined? you need one.

Show quote
"MikeY" <mikesi***@yaho.com> wrote in message
news:OSNGsZ2pGHA.4196@TK2MSFTNGP04.phx.gbl...
> Hi Everyone,
>
> Can anyone see where I'm going wrong? Win [C#]
>
> OleDbConnection thisConnection = new
> OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\HOST
> 017.MDB");
>
> thisConnection.Open();
>
> OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * from
> TableTemplate", thisConnection);
>
> OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(thisAdapter);
>
> DataSet thisDataSet = new DataSet();
>
>
>
> thisAdapter.Fill(thisDataSet,"TableTemplate");
>
>
>
> MessageBox.Show("Before Change:" +
> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"]);
>
>
>
> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"] = "100";
>
> thisAdapter.Update(thisDataSet, "TableTemplate");
>
>
>
> MessageBox.Show("After Change: " +
> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"]);
>
>
>
>
>
> Error being generated is : Syntax error(missing operator) in query
> expression "((ID = ?) and ((? IS NULL AND Nam IS NULL) or (NAME = ?)
> AND....
>
>
>
> It keeps ong on from there. But any and all help would be appreciated.
>
>
>
> Thanks
>
> MikeY
>
>
Author
15 Jul 2006 2:36 PM
MikeY
Hi Jim

Yes I do have a primary key. Txs for the reserved naming convenvention. I've
been trying to find information on naming convention for Access and other
Databases. I'll look into my naming.

Thanks again.

MikeY

Show quote
"Jim Hughes" <NOSPAMJ3033@Hotmail.com> wrote in message
news:erpSFp5pGHA.4684@TK2MSFTNGP05.phx.gbl...
> Name is a reserved word and should not be used for table or column names.
>
> Do you have a primary key defined? you need one.
>
> "MikeY" <mikesi***@yaho.com> wrote in message
> news:OSNGsZ2pGHA.4196@TK2MSFTNGP04.phx.gbl...
>> Hi Everyone,
>>
>> Can anyone see where I'm going wrong? Win [C#]
>>
>> OleDbConnection thisConnection = new
>> OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\HOST
>> 017.MDB");
>>
>> thisConnection.Open();
>>
>> OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * from
>> TableTemplate", thisConnection);
>>
>> OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(thisAdapter);
>>
>> DataSet thisDataSet = new DataSet();
>>
>>
>>
>> thisAdapter.Fill(thisDataSet,"TableTemplate");
>>
>>
>>
>> MessageBox.Show("Before Change:" +
>> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"]);
>>
>>
>>
>> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"] = "100";
>>
>> thisAdapter.Update(thisDataSet, "TableTemplate");
>>
>>
>>
>> MessageBox.Show("After Change: " +
>> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"]);
>>
>>
>>
>>
>>
>> Error being generated is : Syntax error(missing operator) in query
>> expression "((ID = ?) and ((? IS NULL AND Nam IS NULL) or (NAME = ?)
>> AND....
>>
>>
>>
>> It keeps ong on from there. But any and all help would be appreciated.
>>
>>
>>
>> Thanks
>>
>> MikeY
>>
>>
>
>
Author
15 Jul 2006 3:05 PM
Jim Hughes
http://support.microsoft.com/kb/286335/ is the MS document.

Located with
http://www.google.com/search?hl=en&q=access+reserved+words&btnG=Google+Search

Show quote
"MikeY" <mikesi***@yaho.com> wrote in message
news:uBv%23YwBqGHA.2348@TK2MSFTNGP03.phx.gbl...
> Hi Jim
>
> Yes I do have a primary key. Txs for the reserved naming convenvention.
> I've been trying to find information on naming convention for Access and
> other Databases. I'll look into my naming.
>
> Thanks again.
>
> MikeY
>
> "Jim Hughes" <NOSPAMJ3033@Hotmail.com> wrote in message
> news:erpSFp5pGHA.4684@TK2MSFTNGP05.phx.gbl...
>> Name is a reserved word and should not be used for table or column names.
>>
>> Do you have a primary key defined? you need one.
>>
>> "MikeY" <mikesi***@yaho.com> wrote in message
>> news:OSNGsZ2pGHA.4196@TK2MSFTNGP04.phx.gbl...
>>> Hi Everyone,
>>>
>>> Can anyone see where I'm going wrong? Win [C#]
>>>
>>> OleDbConnection thisConnection = new
>>> OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\HOST
>>> 017.MDB");
>>>
>>> thisConnection.Open();
>>>
>>> OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * from
>>> TableTemplate", thisConnection);
>>>
>>> OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(thisAdapter);
>>>
>>> DataSet thisDataSet = new DataSet();
>>>
>>>
>>>
>>> thisAdapter.Fill(thisDataSet,"TableTemplate");
>>>
>>>
>>>
>>> MessageBox.Show("Before Change:" +
>>> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"]);
>>>
>>>
>>>
>>> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"] = "100";
>>>
>>> thisAdapter.Update(thisDataSet, "TableTemplate");
>>>
>>>
>>>
>>> MessageBox.Show("After Change: " +
>>> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"]);
>>>
>>>
>>>
>>>
>>>
>>> Error being generated is : Syntax error(missing operator) in query
>>> expression "((ID = ?) and ((? IS NULL AND Nam IS NULL) or (NAME = ?)
>>> AND....
>>>
>>>
>>>
>>> It keeps ong on from there. But any and all help would be appreciated.
>>>
>>>
>>>
>>> Thanks
>>>
>>> MikeY
>>>
>>>
>>
>>
>
>
Author
18 Jul 2006 12:57 PM
MikeY
Thanks Jim,

It turns out to be the naming convention. But, thank you for your links. the
naming convention page will be very handy.

Thanks again,

MikeY

Show quote
"Jim Hughes" <NOSPAMJ3033@Hotmail.com> wrote in message
news:%237qyeACqGHA.5108@TK2MSFTNGP05.phx.gbl...
> http://support.microsoft.com/kb/286335/ is the MS document.
>
> Located with
> http://www.google.com/search?hl=en&q=access+reserved+words&btnG=Google+Search
>
> "MikeY" <mikesi***@yaho.com> wrote in message
> news:uBv%23YwBqGHA.2348@TK2MSFTNGP03.phx.gbl...
>> Hi Jim
>>
>> Yes I do have a primary key. Txs for the reserved naming convenvention.
>> I've been trying to find information on naming convention for Access and
>> other Databases. I'll look into my naming.
>>
>> Thanks again.
>>
>> MikeY
>>
>> "Jim Hughes" <NOSPAMJ3033@Hotmail.com> wrote in message
>> news:erpSFp5pGHA.4684@TK2MSFTNGP05.phx.gbl...
>>> Name is a reserved word and should not be used for table or column
>>> names.
>>>
>>> Do you have a primary key defined? you need one.
>>>
>>> "MikeY" <mikesi***@yaho.com> wrote in message
>>> news:OSNGsZ2pGHA.4196@TK2MSFTNGP04.phx.gbl...
>>>> Hi Everyone,
>>>>
>>>> Can anyone see where I'm going wrong? Win [C#]
>>>>
>>>> OleDbConnection thisConnection = new
>>>> OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\HOST
>>>> 017.MDB");
>>>>
>>>> thisConnection.Open();
>>>>
>>>> OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * from
>>>> TableTemplate", thisConnection);
>>>>
>>>> OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(thisAdapter);
>>>>
>>>> DataSet thisDataSet = new DataSet();
>>>>
>>>>
>>>>
>>>> thisAdapter.Fill(thisDataSet,"TableTemplate");
>>>>
>>>>
>>>>
>>>> MessageBox.Show("Before Change:" +
>>>> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"]);
>>>>
>>>>
>>>>
>>>> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"] = "100";
>>>>
>>>> thisAdapter.Update(thisDataSet, "TableTemplate");
>>>>
>>>>
>>>>
>>>> MessageBox.Show("After Change: " +
>>>> thisDataSet.Tables["TableTemplate"].Rows[1]["Catagory"]);
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Error being generated is : Syntax error(missing operator) in query
>>>> expression "((ID = ?) and ((? IS NULL AND Nam IS NULL) or (NAME = ?)
>>>> AND....
>>>>
>>>>
>>>>
>>>> It keeps ong on from there. But any and all help would be appreciated.
>>>>
>>>>
>>>>
>>>> Thanks
>>>>
>>>> MikeY
>>>>
>>>>
>>>
>>>
>>
>>
>
>

AddThis Social Bookmark Button