我在sql数据库表中插入值一切正常,但我的表没有如下所示 [英] I am inserting value in sql database table everything is ok but my table is not comming afer as shown below

查看:140
本文介绍了我在sql数据库表中插入值一切正常,但我的表没有如下所示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DataContext dt = new DataContext("Data Source=.;Initial Catalog=mind;Integrated Security=True");
var tbl1 = dt.GetTable<custdetail>();
custdetail cu = new custdetail();
cu.companyname = TextBox1.Text;
cu.emailid = TextBox2.Text;
cu.contactno = TextBox3.Text;
cu.contactname = TextBox4.Text;
cu.productname += "," + chkList.SelectedItem.Text;
cu.address = TextBox5.Text;
 
//Below Is The Line Contain Error
 
dt.cu.insertonsubmit(); // But after dt - cu is not comming what should i dooo..help ! 
 
dt.SubmitChanges(); //

推荐答案

你需要做类似下面的事情

you need to do something like below
db.Custdetail.InsertOnSubmit(cu);
db.SubmitChanges();


这篇关于我在sql数据库表中插入值一切正常,但我的表没有如下所示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆