KAAU

hi all

-------------------------------------------------------------

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

public partial class Personal : System.Web.UI.Page

{

ITS.Learner_PersonalDataTable Personal_Info;

string STUDENT_NAME = "name";

protected void Page_Load(object sender, EventArgs e)

{

ITSTableAdapters.Learner_PersonalTableAdapter adapter = new ITSTableAdapters.Learner_PersonalTableAdapter();

Personal_Info = adapter.GetData();

DataColumn[] keys = new DataColumn[1];

keys[0] = Personal_Info.Columns["Student_Name"];

Personal_Info.PrimaryKey = keys;

DataRow MyRow = Personal_Info.Rows.Find(STUDENT_NAME);

NameTextBox.Text = MyRow["Student_Name"].ToString();

EmailTextBox.Text = MyRow["E-Mail"].ToString();

AddressTextBox.Text = MyRow["Address"].ToString();

TelephoneTextBox.Text = MyRow["Telephone_No"].ToString();

}

protected void UpdateButton_Click(object sender, EventArgs e)

{

ITSTableAdapters.Learner_PersonalTableAdapter adapter = new ITSTableAdapters.Learner_PersonalTableAdapter();

DataRow MyRow = Personal_Info.Rows.Find(STUDENT_NAME);

MyRow["E-Mail"] = EmailTextBox.Text.ToString();

MyRow["Address"] = AddressTextBox.Text.ToString();

MyRow["Telephone_No"] = TelephoneTextBox.Text.ToString();

adapter.Update(Personal_Info);

Label6.Text = "Your Information have been updated successfully";

}

protected void CloseButton_Click(object sender, EventArgs e)

{

}

}

i am trying to update the feild but it seems the update method doesn't work !!!!



Re: .NET Framework Data Access and Storage Can Someone Help me With this ?

BonnieB

Try MyRow.EndEdit() before you do the adapter.Update()




Re: .NET Framework Data Access and Storage Can Someone Help me With this ?

KAAU

BonnieB wrote:
Try MyRow.EndEdit() before you do the adapter.Update()

hi bonnie , it still doesn't save the changes

i am missing something in this





Re: .NET Framework Data Access and Storage Can Someone Help me With this ?

BonnieB

You have to actually "hook up" your TableAdapter to your database ... sorry, I didn't notice that you hadn't done that. I don't use TableAdapters in my DataSets, so I can't help you with the syntax. Read up on it (or maybe you'll get some other replies here).




Re: .NET Framework Data Access and Storage Can Someone Help me With this ?

KAAU

BonnieB wrote:
You have to actually "hook up" your TableAdapter to your database ... sorry, I didn't notice that you hadn't done that. I don't use TableAdapters in my DataSets, so I can't help you with the syntax. Read up on it (or maybe you'll get some other replies here).

hi bonnie thank you ,

i am not sure i understand this "how to hook up mu TableAdapter to my database "





Re: .NET Framework Data Access and Storage Can Someone Help me With this ?

BonnieB

As I said, I don't use TableAdapters. The concept was introduced in 2.0 to allow the DataSets to be able to talk directly to the database ... therefore the DataSet is aware of where it's data comes from.

I don't agree with that concept ... I use DataSets in a disconnected mode. My DataSets know nothing of where the data comes from and for that reason I can pass them from my DataAccess classes (where the database is accessed via DataAdapters and the DataSet is filled), through my Business classes, through my Web Service classes to the front-end UI of the application.

You should probably read up more on the subject (I just googled MSDN and TableAdapter):

http://msdn2.microsoft.com/en-us/library/bz9tthwx(VS.80).aspx

http://msdn2.microsoft.com/en-us/library/ms379590(VS.80).aspx






Re: .NET Framework Data Access and Storage Can Someone Help me With this ?

KAAU

BonnieB wrote:

As I said, I don't use TableAdapters. The concept was introduced in 2.0 to allow the DataSets to be able to talk directly to the database ... therefore the DataSet is aware of where it's data comes from.

I don't agree with that concept ... I use DataSets in a disconnected mode. My DataSets know nothing of where the data comes from and for that reason I can pass them from my DataAccess classes (where the database is accessed via DataAdapters and the DataSet is filled), through my Business classes, through my Web Service classes to the front-end UI of the application.

You should probably read up more on the subject (I just googled MSDN and TableAdapter):

http://msdn2.microsoft.com/en-us/library/bz9tthwx(VS.80).aspx

http://msdn2.microsoft.com/en-us/library/ms379590(VS.80).aspx

thank you so much bonnie , very helpful links , i approciate your help thanks alot





Re: .NET Framework Data Access and Storage Can Someone Help me With this ?

cverdon

Hi,

It's probably not the update that fails but the database that is overwritten everytime the application is compiled.

In the solution explorer, select the database file (.mdf). In the properties window ensure that the Copy To Output Directory setting is set to Do not copy or Copy if newer.

Charles





Re: .NET Framework Data Access and Storage Can Someone Help me With this ?

KAAU

cverdon wrote:

Hi,

It's probably not the update that fails but the database that is overwritten everytime the application is compiled.

In the solution explorer, select the database file (.mdf). In the properties window ensure that the Copy To Output Directory setting is set to Do not copy or Copy if newer.

Charles

thank you charles , i am using an access database file (.mdb) i couldn't find this property !!





Re: .NET Framework Data Access and Storage Can Someone Help me With this ?

cverdon

Is your mdb file in the solution explorer

If not it's probably a different problem.





Re: .NET Framework Data Access and Storage Can Someone Help me With this ?

KAAU

cverdon wrote:

Is your mdb file in the solution explorer

If not it's probably a different problem.

hey charles , it is there database.mdb and when you click on ( + ) there is database.ldb but nothing in the properties window !!!! only the file name and the full path

i am using Dataset and Table Adapters and then an Object DataSource in the web form