您的位置首页百科知识

EXECUTE 后需要有查询名称.为什么

EXECUTE 后需要有查询名称.为什么

string connstr = ConfigurationManager.AppSettings["str"].ToString() + HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["data"].ToString());

OleDbConnection conn = new OleDbConnection(connstr);

conn.Open();

OleDbCommand gx = new OleDbCommand("insert into admin(name) values(@name)", conn);

gx.CommandType = CommandType.StoredProcedure;

gx.Parameters.Add(new OleDbParameter("@name",OleDbType.VarChar,20));

gx.Parameters["@name"].Value = "sdfsdf";

int i=gx.ExecuteNonQuery();

conn.Close();