访问c#中数据集中的数据库

时间:2012-04-02 17:49:14

标签: c# dataset tableadapter

我将访问数据库与我的wpf应用程序连接起来。使用oledb连接。数据库连接没问题。我正在使用数据集。一切都很好。应该插入数据。但是表没有数据。(当我转到我的数据集并点击相应tableadapter的预览数据时。)我的代码如下:

lstOwnerLeaseAgreement = taOwnerLeaseAgreement.GetData().ToList();

                double? dateof2dayDAY = double.Parse(dtDateOfToday.DisplayDate.Day.ToString());
                string dateof2dayMONTH = dtDateOfToday.DisplayDate.Month.ToString();
                double? dateof2dayYEAR = double.Parse(dtDateOfToday.DisplayDate.Year.ToString());

                double? firstDAY = double.Parse(dt1stDateofLease.DisplayDate.Day.ToString());
                string firstMONTH = dt1stDateofLease.DisplayDate.Month.ToString();
                double? firstYEAR = double.Parse(dt1stDateofLease.DisplayDate.Year.ToString());

                double? LastDAY = double.Parse(dtLastDateofLease.DisplayDate.Day.ToString());
                string LastMONTH = dtLastDateofLease.DisplayDate.Month.ToString();
                double? LastYEAR = double.Parse(dtLastDateofLease.DisplayDate.Year.ToString());

                taOwnerLeaseAgreement.Insert(dateof2dayDAY, dateof2dayMONTH, dateof2dayYEAR, txtLandlord.Text, txtTenant.Text, txtApproval.Text, double.Parse(txtApprovalDays.Text), txtPropertyAddress.Text, txtCity.Text, txtProvince.Text, firstDAY, firstMONTH, firstYEAR, LastDAY, LastMONTH, LastYEAR, double.Parse(txtRenewalofLeaseFee.Text), double.Parse(txtNumMonthsRenewal.Text), decimal.Parse(txtRent.Text), decimal.Parse(txtCredits.Text), txtLawsOfProvince.Text, dtSigningDate.DisplayDate.ToShortDateString());

                System.Windows.MessageBox.Show("hu lala lal");

0 个答案:

没有答案