Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-07-2005, 08:42 PM   PM User | #1
petela
New Coder

 
Join Date: Jan 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
petela is an unknown quantity at this point
Problem updating dataset

Hi,

I am in the process of learning how to read and write to a database using .NET methods. I came across the relevant article contained in the following link:

http://msdn.microsoft.com/library/de...dwritedata.asp

It is fairly straightforward, but there seems to be a problem with the CategoriesRow method, which is used to find a specific row in the dataset. After doing some research, I have found that others are having problems with this method. Here is my code (offending lines in red, error message at bottom):

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace bridgeport
{
public class editlogin : System.Web.UI.Page
{
protected System.Data.SqlClient.SqlDataAdapter LoginSqlDataAdapter;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
protected System.Data.SqlClient.SqlConnection LoginSqlConnection;
protected System.Web.UI.WebControls.DataGrid LoginDataGrid;
protected bridgeport.LoginDataSet loginDataSet;

private void Page_Load(object sender, System.EventArgs e)
{
LoginSqlDataAdapter.Fill(loginDataSet);
if (!IsPostBack)
{
LoginDataGrid.DataBind();
}
}



private void LoginDataGrid_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
LoginDataGrid.EditItemIndex = e.Item.ItemIndex;
LoginDataGrid.DataBind();
}

private void LoginDataGrid_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
LoginDataGrid.EditItemIndex = -1;
LoginDataGrid.DataBind();
}

private void LoginDataGrid_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string loginName, loginPassword;

// Get the value of the key field of the row bing updated
string key = LoginDataGrid.DataKeys[e.Item.ItemIndex].ToString();

TextBox tb;

// Get the value of the TextBox control in the third column
tb = (TextBox)(e.Item.Cells[2].Controls[0]);
loginName = tb.Text;

loginDataSet.CategoriesRow r;
r = loginDataSet.Categories.FindByCategoryID(int.Parse(key));
}
}
}


c:\inetpub\wwwroot\visual studio projects\bridgeport\editlogin.aspx.cs(150,4): error CS0118: 'bridgeport.editlogin.loginDataSet' denotes a 'field' where a 'class' was expected

Any ideas on how to fix the problem?

Thanks,
petela
petela is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:58 AM.


Advertisement
Log in to turn off these ads.