Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
please inform me what is the wrong in the below coding


private void button1_Click(object sender, System.EventArgs e)
{

if ((textName.Text == " ") || (textadd.Text == " "))
{
MessageBox.Show("enter the proper data");
return;

}
cnn.Open(sqlconn," "," ",0);
object recafec;
string conn =( "INSERT INTO categories(categoryName,description)" + "VALUES(' " + textName.Text + "','" + textadd.Text + "')");
cnn.Execute(sqlconn,out recafec ,0 );
if (Convert.ToInt32(recafec) == 1)
{
MessageBox.Show("updated");

}


}




if you get asolution
please explain me
Posted

I'm sorry, but I am confused. Are we supposed to guess at what the problem is?
 
Share this answer
 
v2
wrote:
please inform me what is the wrong in the below coding


1 - your chosen subject is idiotic. EVERYONE wants an answer for their question

2 -
wrote:
button1_Click



You seem to be trying to make your code unreadable, by not giving your variables sensible names

3 -


wrote:
string conn =( "INSERT INTO categories(categoryName,description)" + "VALUES(' " + textName.Text + "','" + textadd.Text + "')");


You seem to know nothing about SQL injection, so you're writing a system with a database that anyone can erase if they want to.

4 - you post vague questions, almost as if you don't want an answer. What makes you feel this code is not working ? What do you expect it to do ? What does it do ? What error message, if any, do you get, and what line generates it ?

Please edit your post and try to think in terms of what we need to know in order to try to help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900