U
uluvale96799
Hi,
I'm very new to programming so forgive me for asking the dumb question.
I'm trying to develop a database application using c#, and I'm using
the northwind database. I'm currently using visual c# express edition
2005 as well as sql 2005 express.
Here's the thing I've been trying to figure out. I want to insert a new
row in the Employees Table when I click a button called btnAdd. When I
was learning delphi, I would just put the dataset into insert mode for
instance dataset.insert.
How can I achieve this in visual c# I'm wondering. Here's my code.
Please, let me know if there's anymore details I can give. I usually
find the solution by googling it, but I've been stuck on this for a
while.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Northwind
{
public partial class frmEmployeeDB : Form
{
public frmEmployeeDB()
{
InitializeComponent();
}
/* private void frmEmployeeDB_Load(object sender, EventArgs e)
{
NORTHWNDDataSet.EmployeesRow newEmployeesRow;
newEmployeesRow = NORTHWNDDataSet
}*/
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnAdd_Click(object sender, EventArgs e)
{
NORTHWNDDataSetTableAdapters.EmployeesTableAdapter
employeeTableAdapter =
new
Northwind.NORTHWNDDataSetTableAdapters.EmployeesTableAdapter();
employeeTableAdapter.Insert();
}
private void frmEmployeeDB_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the
'nORTHWNDDataSet.Employees' table. You can move, or remove it, as
needed.
this.employeesTableAdapter.Fill(this.nORTHWNDDataSet.Employees);
}
/* private void bindingSource1_CurrentChanged(object sender,
EventArgs e)
{
}*/
}
}
Thanks,
Charles
I'm very new to programming so forgive me for asking the dumb question.
I'm trying to develop a database application using c#, and I'm using
the northwind database. I'm currently using visual c# express edition
2005 as well as sql 2005 express.
Here's the thing I've been trying to figure out. I want to insert a new
row in the Employees Table when I click a button called btnAdd. When I
was learning delphi, I would just put the dataset into insert mode for
instance dataset.insert.
How can I achieve this in visual c# I'm wondering. Here's my code.
Please, let me know if there's anymore details I can give. I usually
find the solution by googling it, but I've been stuck on this for a
while.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Northwind
{
public partial class frmEmployeeDB : Form
{
public frmEmployeeDB()
{
InitializeComponent();
}
/* private void frmEmployeeDB_Load(object sender, EventArgs e)
{
NORTHWNDDataSet.EmployeesRow newEmployeesRow;
newEmployeesRow = NORTHWNDDataSet
}*/
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnAdd_Click(object sender, EventArgs e)
{
NORTHWNDDataSetTableAdapters.EmployeesTableAdapter
employeeTableAdapter =
new
Northwind.NORTHWNDDataSetTableAdapters.EmployeesTableAdapter();
employeeTableAdapter.Insert();
}
private void frmEmployeeDB_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the
'nORTHWNDDataSet.Employees' table. You can move, or remove it, as
needed.
this.employeesTableAdapter.Fill(this.nORTHWNDDataSet.Employees);
}
/* private void bindingSource1_CurrentChanged(object sender,
EventArgs e)
{
}*/
}
}
Thanks,
Charles