本文介绍了如何从错误中恢复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

使用LinQ将数据从表单插入数据库时​​出现此错误



当我输入类的对象时(例如:Employee empObj = new Employee())它显示错误。

使用(DataClass1DataContext DcContext = new DataClass1DataContext())
{
ArticleMdl articleObj = new ArticleMdl();
articleObj.Title = TextBox1.Text;
articleObj.Summary = TextBox2.Text;
articleObj.Tags = TextBox3.Text;
articleObj.Image = TextBox4.Text;
articleObj.Category = Convert.ToInt32(RadioButtonList1.SelectedValue);
articleObj.Subcategory = Convert.ToInt32(RadioButtonList2.SelectedValue);

DcContext.tblArticles.InsertOnSubmit(articleObj);
DcContext.SubmitChanges();
Label1.Text =你的文章已保存。;
}









请回复如何恢复它。



我尝试了什么:



尝试插入直接值到属性。出现相同的错误。

解决方案

I'm getting this error while inserting data from my form to database using LinQ

When I enter the object of the class(e.g: Employee empObj = new Employee()) It shows the error.

using (DataClass1DataContext DcContext = new DataClass1DataContext())
                {
                    ArticleMdl articleObj = new ArticleMdl();
                    articleObj.Title = TextBox1.Text;
                    articleObj.Summary = TextBox2.Text;
                    articleObj.Tags = TextBox3.Text;
                    articleObj.Image = TextBox4.Text;
                    articleObj.Category = Convert.ToInt32(RadioButtonList1.SelectedValue);
                    articleObj.Subcategory = Convert.ToInt32(RadioButtonList2.SelectedValue);

                    DcContext.tblArticles.InsertOnSubmit(articleObj);
                    DcContext.SubmitChanges();
                    Label1.Text = "Your article is saved.";
                }





Please do reply how to recover it.

What I have tried:

Tried to insert on putting of direct values to the properties. The same error arose.

解决方案


这篇关于如何从错误中恢复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 02:57