错误描述:
Error 1 The type or namespace name 'SqlConnection' could not be found (are you missing a using directive or an assembly reference?) E:\周金玉\net\person_web\Default.aspx.cs 27 10 E:\...\person_web\
Error 2 The type or namespace name 'SqlConnection' could not be found (are you missing a using directive or an assembly reference?) E:\周金玉\net\person_web\Default.aspx.cs 27 41 E:\...\person_web\
Error 3 The type or namespace name 'SqlCommand' could not be found (are you missing a using directive or an assembly reference?) E:\周金玉\net\person_web\Default.aspx.cs 30 9 E:\...\person_web\
Error 4 The type or namespace name 'SqlCommand' could not be found (are you missing a using directive or an assembly reference?) E:\周金玉\net\person_web\Default.aspx.cs 30 34 E:\...\person_web\
Error 5 The type or namespace name 'SqlParameter' could not be found (are you missing a using directive or an assembly reference?) E:\周金玉\net\person_web\Default.aspx.cs 31 36 E:\...\person_web\
Error 6 The type or namespace name 'SqlParameter' could not be found (are you missing a using directive or an assembly reference?) E:\周金玉\net\person_web\Default.aspx.cs 32 36 E:\...\person_web\
这是我的原代码:
protected void Button2_Click(object sender, EventArgs e)
{
String caption = TextBox2.Text;
bool ispublic = false;
if (CheckBox1.Checked)
ispublic = true;
addalbum(caption, ispublic);
}
public static void addalbum(string caption, bool ispublic)
{
SqlConnection connection = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["personal"].ToString());
string sql;
sql = "insert into albums([caption],[ispublic])values(@caption,@ispublic)";
SqlCommand command = new SqlCommand(sql, connection);
command.parameters.add(new SqlParameter("@caption",caption));
command.parameters.add(new SqlParameter("@ispublic",ispublic));
connection.open();
command.executenonquery();
}
请会的指教在下!谢谢了!我刚学!