我的客户表customer字段类型为varchar型的 ,但是我在插入数据时不能插入字母,符号,只能插入数字类型的字符串
比如插入 “lly.sfa”就不行,但是插入“54215642”就可以 。下面是我的代码
try
{
string username = TextBox1.Text;
string password = TextBox2.Text;
string againpassword = TextBox3.Text.;
string phonenumber = TextBox4.Text.();
Random ran = new Random();
int id = Convert.ToInt32(string.Format("{0:ddHHmmss}", DateTime.Now) + ran.Next(0, 10));
string sqlselete = "select count(*) from customer where customer_name=" + username;
dataOperate sqlopereat = new dataOperate();
int num = sqlopereat.IsData(sqlselete);
if (num == 0)
{
try
{
string sqlupdata = "insert into customer(customer_id,customer_name,customer_password,customer_phone,customer_level) values(" + id+"," + phonenumber+","+username+","+password+","+ "5) ";
//bool a=sqlopereat.Insert(sqlupdata);
//if (a==true)
//{
// Response.Write("恭喜 注册成功");
//}
bool result = sqlopereat.AdlData(sqlupdata);
if (result == true)
{
Response.Write("恭喜 注册成功");
}
}
catch (Exception)
{
throw;
}
}
}
catch (Exception)
{
throw;
}
}
数据库连接没有问题 我用的是VS2015内置的数据库 是这个的问题吗?