here is my code
SqlCommand insert_user = new SqlCommand("insert into dbo.users (username,password,firstname,lastname,address,country,city,phonenumber,gender,email) VALUES (' bader','123','beno','venp','33','pal','d',''1234','male'," + @TextBox3.Text + ");", badersql);
what i am trying is to insert from textbox3.text to my sql email column , the problem is when i try that , this error msg during debuging popups " Error 9 The name 'TextBox3' does not exist in the current context".
i tried '" + TextBox3.text + "' with @ and without , same problem
if it helps , here is all my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data.Sql;
public partial class Default4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection badersql = new SqlConnection("Data Source=BADER-VAIO\\SQLEXPRESS;Initial Catalog=webage;Persist Security Info=True;User ID=sa;Password=123");
badersql.Open();
SqlCommand insert_user = new SqlCommand("insert into dbo.users (username,password,firstname,lastname,address,country,city,phonenumber,gender,email) VALUES (' bader','123','beno','venp','33','pal','d',''1234','male'," + @TextBox3.Text + ");", badersql);
insert_user.ExecuteNonQuery();
//insert into webpage.dbo.users (username,password,firstname,lastname,address,country,city,phonenumber,gender,email) VALUES (' bader','123','beno','venp','33','pal','d',''1234','male','[email protected]');
badersql.Close();
}
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
}
}
any suggestions ?
regards,