日期:2014-05-18 浏览次数:20476 次
string title = TitleText.Text.ToString(); string neirong = Request.Form["neirong"]; string beizhu = Request.Form["beizhu"]; string maker = "00000";//Session["UserID"].ToString(); string time = DateTime.Now.ToString(); string insertString = "insert into other_task values('" + maker + "','"+ title + "','" + neirong + "','" + beizhu + "','" + time + ",null," + "null" + "')"; string sqlString = "Data Source=localhost;Initial Catalog=gsc;User ID=sa;PassWord=123456"; SqlConnection insertConn = new SqlConnection(sqlString); insertConn.Open(); SqlCommand insertComm = new SqlCommand(insertString, insertConn); insertComm.ExecuteNonQuery();//此行提示错误
CREATE TABLE [dbo].[other_task]( [TaskID] [int] IDENTITY(1,1) NOT NULL, [Maker] [char](5) NULL, [Title] [nvarchar](255) NULL, [neirong] [nvarchar](255) NULL, [beizhu] [nvarchar](255) NULL, [tbegin] [smalldatetime] NULL, [tend] [smalldatetime] NULL, [finflag] [bit] NULL ) ON [PRIMARY]