其他信息: Update 无法找到 TableMapping['StudentMsg'] 或 DataTable“StudentMsg”。
privatevoidStudentFrm_Load(objectsender,EventArgse){ShowStudents();}privateSqlDataAda...
private void StudentFrm_Load(object sender, EventArgs e)
{
ShowStudents();
}
private SqlDataAdapter da = new SqlDataAdapter();
private DataSet ds = new DataSet("Userinfor");
private void ShowStudents()
{
string connString = @"Data Source=.\SQLEXPRESS;Data Source=DELL-PC;Initial Catalog=Userinfor;Integrated Security=True";
string sql = "select StudentId as 学号,StudentName as 姓名, sex as 性别,Brithday as 出生年月,Department as 院系,Speciality as 专业 from StudentMsg";
SqlConnection conn = new SqlConnection(connString);
conn.Open();
SqlCommand comm = new SqlCommand(sql, conn);
da.SelectCommand = comm;
SqlCommandBuilder builder = new SqlCommandBuilder(da);
da.Fill(ds, "StudentMsg");
dgvStudent.DataSource = ds.Tables["StudentMsg"];
conn.Close();
}
private void button1_Click(object sender, EventArgs e)
{
da.Update(ds, "StudentMsg");
MessageBox.Show("数据更新已经成功!", "注意", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
} 展开
{
ShowStudents();
}
private SqlDataAdapter da = new SqlDataAdapter();
private DataSet ds = new DataSet("Userinfor");
private void ShowStudents()
{
string connString = @"Data Source=.\SQLEXPRESS;Data Source=DELL-PC;Initial Catalog=Userinfor;Integrated Security=True";
string sql = "select StudentId as 学号,StudentName as 姓名, sex as 性别,Brithday as 出生年月,Department as 院系,Speciality as 专业 from StudentMsg";
SqlConnection conn = new SqlConnection(connString);
conn.Open();
SqlCommand comm = new SqlCommand(sql, conn);
da.SelectCommand = comm;
SqlCommandBuilder builder = new SqlCommandBuilder(da);
da.Fill(ds, "StudentMsg");
dgvStudent.DataSource = ds.Tables["StudentMsg"];
conn.Close();
}
private void button1_Click(object sender, EventArgs e)
{
da.Update(ds, "StudentMsg");
MessageBox.Show("数据更新已经成功!", "注意", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
} 展开
1个回答
摩杜云
2024-07-09 广告
2024-07-09 广告
判断一个发送邮件api公司的好坏,不只是看价格,还要考虑很多因素。建议可以多对比几个看看。您可以到摩杜云了解下。摩杜云成立于2019年,依托于公司多年技术沉淀和强大的云计算研发实力,面向全世界各个国家和地区、企业组织和个人开发者,提供全球的...
点击进入详情页
本回答由摩杜云提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询