oh man..."place= '" + textBox3.Text + "'+" + "where id='" + textBox1.Text +
"'"
you have '"" there instead of '"...
but no really, replace the line

string str = "update samp set name= '" + textBox2.Text + "', " +
"place= '" + textBox3.Text + "'+" + "where id='" + textBox1.Text +
"'";
with line
string str = string.Format("update samp set name='{0}'; place='{1}' where id
='{2}'", textBox2.Text, textBox3.Text, textBox1.Text);
and there will be no problems

2009/8/26 Muruga Swaminathan A <[email protected]>

> thanks for ur reply, but now i got error as: " characters found after end
> of sql statement "
>
>
> On Wed, Aug 26, 2009 at 12:49 PM, Processor Devil <
> [email protected]> wrote:
>
>> string str = "update samp set name= '" + textBox2.Text + "', " +
>> "place= '" + textBox3.Text + "'+" + "where id='" + textBox1.Text +
>> "'";
>> Yeah, it is the + as Cerebrus said :).
>> Well, for next time try to use string.Format function instead of this
>> quote storm, your example would look like
>> string str = string.Format("update samp set name='{0}'; place='{1}' where
>> id ='{2}'", textBox2.Text, textBox3.Text, textBox1.Text);
>>
>> 2009/8/25 Cerebrus <[email protected]>
>>
>>
>>> + "'+" +
>>>
>>> The least you can do is check your update statement.
>>>
>>> On Aug 25, 7:17 pm, A M Swaminathan <[email protected]> wrote:
>>> > hello  everybody,
>>> >
>>> > i am swami. i had developed a c#.net windows application with access
>>> > database..
>>> > in update operation i got error..  pls help me..
>>> >
>>> > The code is:
>>> >
>>> > OleDbConnection con = new OleDbConnection
>>> > ("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\\cictapp.mdb"
>>> > OleDbDataAdapter od;
>>> > DataSet ds;
>>> > string str = "update samp set name= '" + textBox2.Text + "', " +
>>> > "place= '" + textBox3.Text + "'+" + "where id='" + textBox1.Text +
>>> > "'";
>>> >                 od = new OleDbDataAdapter(str, con);
>>> >                 ds = new DataSet();
>>> >                 od.Fill(ds, "samp");
>>> >                 label4.Text = "Record Updated";
>>> >
>>> > thanks in advance..
>>> >
>>> > regards
>>> > swaminathan.
>>>
>>
>>
>
>
> --
> regards
> Swaminathan
>
>

Reply via email to