D
DC
Trying to use the classic CommandBuilder and datagrid binding method
under c# to update add and remove records form a single table database,
I keep getting the error.
"CS0117: 'System.Web.UI.WebControls.DataGrid' does not contain a
definition for 'SetDataBinding'"
Why would this be?
<%@ import namespace="System" %>
<%@ import namespace="System.Web" %>
<%@ import namespace="System.Web.UI" %>
<%@ import namespace="System.Web.UI.HtmlControls" %>
<%@ import namespace="System.Web.UI.WebControls" %>
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.OleDb" %>
<html>
<head>
<title>Meetings Admin Page</title>
<META HTTP-EQUIV=REFRESH CONTENT=1800>
<link REL="ICON" HREF="http://www.met.rdg.ac.uk/favicon.ico">
<link REL="SHORTCUT ICON" HREF="http://www.met.rdg.ac.uk/favicon.ico">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<script language="C#" runat="server">
private void GridBind()
{
string ConnString ="Provider=Microsoft.Jet.OLEDB.4.0;"
+ "Data Source=C:\\Program Files\\Common Files\\ODBC\\Data
Sources\\seminars.mdb;";
OleDbConnection myConnection= new OleDbConnection(ConnString);
DataSet SeminarsDataSet = new DataSet();
///fill the dataset
SeminarsAdapter.Fill(SeminarsDataSet, "SeminarsList");
///set the dataset as a datasource for windows datagrid
datagrid1.SetDataBinding(SeminarsDataSet, "SeminarsList");
}
private void btnSave_Click(object sender, System.EventArgs e)
{
try
{
///the following statement
///inserts
///updates
///deletes for you
/// Without the CommandBuilder, this line would fail.
SeminarsAdapter.Update(SeminarsDataSet,"SeminarsList");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
</script>
</head>
<body bgcolor=#FFFFFF>
<!-- Start of page header section -->
<!-- Stylesheet Location -->
<link rel="stylesheet" type="text/css"
href="/scripts/includes/metstyle.css">
<!-- Page Header info goes here -->
<center>
<H3>Seminars Admin Page</H3>
<asp:datagrid id="datagrid1" runat="server" />
</center>
</body>
</html>
--
_______________________________________________
DC
"You can not reason a man out of a position he did not reach through reason"
"Don't use a big word where a diminutive one will suffice."
"A man with a watch knows what time it is. A man with two watches is
never sure." Segal's Law
under c# to update add and remove records form a single table database,
I keep getting the error.
"CS0117: 'System.Web.UI.WebControls.DataGrid' does not contain a
definition for 'SetDataBinding'"
Why would this be?
<%@ import namespace="System" %>
<%@ import namespace="System.Web" %>
<%@ import namespace="System.Web.UI" %>
<%@ import namespace="System.Web.UI.HtmlControls" %>
<%@ import namespace="System.Web.UI.WebControls" %>
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.OleDb" %>
<html>
<head>
<title>Meetings Admin Page</title>
<META HTTP-EQUIV=REFRESH CONTENT=1800>
<link REL="ICON" HREF="http://www.met.rdg.ac.uk/favicon.ico">
<link REL="SHORTCUT ICON" HREF="http://www.met.rdg.ac.uk/favicon.ico">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<script language="C#" runat="server">
private void GridBind()
{
string ConnString ="Provider=Microsoft.Jet.OLEDB.4.0;"
+ "Data Source=C:\\Program Files\\Common Files\\ODBC\\Data
Sources\\seminars.mdb;";
OleDbConnection myConnection= new OleDbConnection(ConnString);
DataSet SeminarsDataSet = new DataSet();
///fill the dataset
SeminarsAdapter.Fill(SeminarsDataSet, "SeminarsList");
///set the dataset as a datasource for windows datagrid
datagrid1.SetDataBinding(SeminarsDataSet, "SeminarsList");
}
private void btnSave_Click(object sender, System.EventArgs e)
{
try
{
///the following statement
///inserts
///updates
///deletes for you
/// Without the CommandBuilder, this line would fail.
SeminarsAdapter.Update(SeminarsDataSet,"SeminarsList");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
</script>
</head>
<body bgcolor=#FFFFFF>
<!-- Start of page header section -->
<!-- Stylesheet Location -->
<link rel="stylesheet" type="text/css"
href="/scripts/includes/metstyle.css">
<!-- Page Header info goes here -->
<center>
<H3>Seminars Admin Page</H3>
<asp:datagrid id="datagrid1" runat="server" />
</center>
</body>
</html>
--
_______________________________________________
DC
"You can not reason a man out of a position he did not reach through reason"
"Don't use a big word where a diminutive one will suffice."
"A man with a watch knows what time it is. A man with two watches is
never sure." Segal's Law