Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

i have a problem for the INSERT part. :( :(

i only know how to add data into database...like:

 

		SqlCommand myCommand = new SqlCommand("Insert into employee(id, name, pass) values('1','John','aaa')", sqlConnection1);

 

but, i don't know how to use the TextBox insert data to database. What is the codes for the VALUES part? Who know can help me???

  • Moderators
Posted

Assuming that the ID column is numeric you may want to get rid of the single quotes and converting the value to Int, I'm not sure of any J# syntax....

 

SqlCommand myCommand = new SqlCommand("Insert into employee(id, name, pass) values(" + Convert.ToInt32(TextBoxID.Text) + ",'" + TextBox1.Text + "','" + TextBox2.Text + "')", sqlConnection1);

Visit...Bassic Software
Posted
Assuming that the ID column is numeric you may want to get rid of the single quotes and converting the value to Int, I'm not sure of any J# syntax....

 

SqlCommand myCommand = new SqlCommand("Insert into employee(id, name, pass) values(" + Convert.ToInt32(TextBoxID.Text) + ",'" + TextBox1.Text + "','" + TextBox2.Text + "')", sqlConnection1);

 

i think this one is use at the VB.NET one

because J# dont have .text one

Posted

thanks....

but i tried already still cannot add-in database.

This is my new changing codes:

 

SqlCommand myCommand = new SqlCommand("Insert into employee(id, name, pass) values(" + textBox1.get_Text() + "," + textBox2.get_Text() + "," + textBox3.get_Text() + ")", sqlConnection1);

 

who know abt the J# syntax??? can somebody help me...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...