未将对象引用设置到对象的实例
代码不长,这是我在datagrid做插入命令时,出现的问题,textbox是网页的文本框名。下面是.cs中的程序。
String insertCmd = "insert into newsType (type) values (@textbox)";
SqlCommand myCommand = new SqlCommand(insertCmd, myConnection);
myCommand.Parameters.Add(new SqlParameter("@textbox", SqlDbType.NVarChar, 20));
myCommand.Parameters["@textbox"].Value = textbox.Text;//???????????????
myCommand.Connection.Open();