在sql2005无法插入记录
请教了:我是初学者,我把源程序贴在下面,请各位老师帮我诊断,问题出在哪?
SqlConnection conn = new SqlConnection("Data Source=SERVER\\SQL2005;Initial Catalog=toucherDB;Persist Security Info=True;User ID=sa;Password=sa123456");
conn.Open();
SqlCommand scd = new SqlCommand("select * from test", conn);
try
{
= "insert into test(user_name,depa_info) values(@user_name,@depa_info)";
SqlParameter para = new SqlParameter("@user_name", SqlDbType.VarChar, 50);
para.Value = user_name;
scd.Parameters.Add(para);
para = new SqlParameter("@depa_info", SqlDbType.VarChar, 50);
para.Value = depa_info;
scd.Parameters.Add(para);
scd.ExecuteNonQuery();
整整一天了,我都没找出问题来。