怎样往数据库里i添加数据
就是我现在在做一个作业提交系统,我负责的部分是老师那一部分,现在做老师发布作业那一块,就是往数据库里添加作业,运行时出现了这样的错误错误 1 无法将类型“string”隐式转换为“System.Data.SqlClient.SqlCommand” F:\vs\taskSystem\湘南学院计算机系作业系统\teacher\teach_taskGiving.aspx.cs 34 25 F:\...\teacher\
源代码
protected void Button1_Click(object sender, EventArgs e)
{ SqlConnection myConnection;
string connectionStr="Data Source=PC-20110420OTTI\\SQLEXPRESS;Initial Catalog=tasksystem;Integrated Security=True;Pooling=False";
myConnection =new SqlConnection (connectionStr );
myConnection.Open ();
SqlCommand com ="inset into tb_assingwork values('" + DropDownList1.Text.Trim() + "','" + DropDownList2.Text.Trim() + "','" + DropDownList3.Text.Trim() + "','" + DropDownList4.Text.Trim() + "','" + TextBox2.Text.Trim() + "','" + TextBox1.Text.Trim() + "')";
com.ExecuteNonQuery ();
myConnection.Close();
}
麻烦哪位能帮我解决一些,谢谢!