I am working on my first C# SQL project. A simple checkbook register.
I referred to the CodeProject article:
Using the DataGrid Control:
Using the DataGrid Control[
^]
I added a datagridview control to my form and set the data source as my checkbook register in SQL Express.
I am able to see all the checkbook entries when I run the form.
My first attempt at updating the sql table is generating a compile error.
The error is:
cannot convert from 'System.Data.DataSet' to 'FirstCheckBookInSQL.CheckBookManagementDataSet.CheckbookUSBPersonalDataTable'
I've been researching this for 3 days, but I'm just not making sense of what I am seeing.
Can someone help please!
Thank you.
Mark
My code in Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace FirstCheckBookInSQL
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.checkbookUSBPersonalTableAdapter.Fill(this.checkBookManagementDataSet.CheckbookUSBPersonal);
}
private void TBDbutton_Click(object sender, EventArgs e)
{
DataSet myChangedDataSet = this.checkBookManagementDataSet.GetChanges();
if (myChangedDataSet != null)
{
<big>
int modifiedRows = this.checkbookUSBPersonalTableAdapter.Update(myChangedDataSet);</big>
this.checkBookManagementDataSet.AcceptChanges();
myChangedDataSet.AcceptChanges();
}
MessageBox.Show("no data changed");
}
}
}