473,396 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

autosave in datagrid.

I am using dataset as a datasource for my datagrid. I'm wondering how
to program to autosave the changes made in a datagrid just like
microsoft access.

any help is greatly appreciated.
Nov 20 '05 #1
7 2593
Cor
Hi JaYpee,

Can you tell us what you did till now to do that?
Otherwise maybe our startpoint is to far back.

(Did you already made a dataadapter.update by instance?)

Cor
I am using dataset as a datasource for my datagrid. I'm wondering how
to program to autosave the changes made in a datagrid just like
microsoft access.

any help is greatly appreciated.

Nov 20 '05 #2
On Fri, 2 Jan 2004 09:15:11 +0100, "Cor" <no*@non.com> wrote:
Hi JaYpee,

Can you tell us what you did till now to do that?
Otherwise maybe our startpoint is to far back.

(Did you already made a dataadapter.update by instance?)

Cor

i am not too very familiar w/ different kinds of connection but i
think what u said is came from the wizard. like
OleDbDataAdapter1.Update(DsAuthors1) or an sql adapter. the source i
am working on is a hard coded source code from 101 example as i have
mentioned from my previous post.

by d way sorry for replying w/ a different thread.

the code from the sample looks something like this. this is my source
code now that come from the sample.

Dim scnnNW As New SqlConnection(strConn)

Dim strSQL As String = _
"SELECT IDNo, LastName, FirstName " & _
"FROM Students"

' A SqlCommand object is used to execute the SQL
commands.
Dim scmd As New SqlCommand(strSQL, scnnNW)

' A SqlDataAdapter uses the SqlCommand object to fill
a DataSet.
sda = New SqlDataAdapter(scmd)

' A SqlCommandBuilder automatically generates the SQL
commands needed
' to update the database later (in the btnSave_Click
event handler).
Dim scb As New SqlCommandBuilder(sda)

' The commands generated by the SqlCommandBuilder are
based on the
' currently set CommandText of the SqlCommand object.
As this will
' be changing to a SQL statement that won't be needed
for an Update
' in the btnSave Click event handler, you can call
GetUpdateCommand
' explicitly to generate the Update command based on
the current
' CommandText property value.
scb.GetUpdateCommand()

' Create a new DataSet and fill its first DataTable.
dsStudentCourse = New DataSet()
sda.Fill(dsStudentCourse, "Students")

' Reset the CommandText to get the Employee orders.
scmd.CommandText = _
"SELECT SchYrSemID, IDNo, SchYr, Sem FROM
SchYrSem"

' Fill the second table in the DataSet.
sda.Fill(dsStudentCourse, "SchYrSem")

' Reset the CommandText to get the Order details.
scmd.CommandText = _
"SELECT SchYrSemCourseID, SchYrSemID,
Course.CourseID, CourseTitle, CourseDesc, Unit, [Hours/Week] FROM
Course INNER JOIN SchYrSemCourseJoin ON Course.CourseID =
SchYrSemCourseJoin.CourseID"

' Fill the fourth table in the DataSet.
sda.Fill(dsStudentCourse, "SchYrSemCourseJoin")

and i don't know how can i update the datagrid now.

thanks if u can help me w/ this problem.

I am using dataset as a datasource for my datagrid. I'm wondering how
to program to autosave the changes made in a datagrid just like
microsoft access.

any help is greatly appreciated.


Nov 20 '05 #3
Cor
Hi jaYPee,

To update a dataset you have to use a SQLdataadapter or OLeDBdataadapter

Basicly you wrote it already,
SQLdatatadapter.update(ds)

It is confusing if you use samples which are made by the designer or all by
hand.

But have a look to the dataadaper, and keep in mind reading the
documentation, that there is a lot of difference when all is made by the
designer or by hand but you can not recognize that direct in the samples.
(The sample you are using is not using the designer as far as I know).

It is a lot of work for the first time to use that sample to do what you
ask, I think it is better to make some code yourself looking at that sample,
by instance

That has one datagrid,
That has one database (employees from northwind is nice for that)
That has one button

In the load event of the form you read it using the datadatper.fill.
In the button click event you write it back using the dataadapter.update

If you have made that and you have problems, tell the problems than we can
help you further I think.

Success,

I hope this did help a little bit?

Cor
Nov 20 '05 #4
On Sat, 3 Jan 2004 08:49:29 +0100, "Cor" <no*@non.com> wrote:

thanks u very much for the support. i have found out that when i
update the dataset it gives me an error telling "dynamic sql
generation is not supported against multiple base tables". since the
dataset contains 4 table so may be this is what the error come from.

by d way i try to use the sample from 101 samples because i want to
have a form like that. it contains a parent form and a two child form.
just like what we can see in the sample database of microsoft access
97 entitled video collection wizard. i don't have any problem creating
this kind of database using microsoft access but i want to migrate to
vb .net and i have trouble learning this new language.

i am very thankful if u can point me to any sample program that
resembles from the sample made by microsoft (ie the 101 sample app)

thanks once again.
Hi jaYPee,

To update a dataset you have to use a SQLdataadapter or OLeDBdataadapter

Basicly you wrote it already,
SQLdatatadapter.update(ds)

It is confusing if you use samples which are made by the designer or all by
hand.

But have a look to the dataadaper, and keep in mind reading the
documentation, that there is a lot of difference when all is made by the
designer or by hand but you can not recognize that direct in the samples.
(The sample you are using is not using the designer as far as I know).

It is a lot of work for the first time to use that sample to do what you
ask, I think it is better to make some code yourself looking at that sample,
by instance

That has one datagrid,
That has one database (employees from northwind is nice for that)
That has one button

In the load event of the form you read it using the datadatper.fill.
In the button click event you write it back using the dataadapter.update

If you have made that and you have problems, tell the problems than we can
help you further I think.

Success,

I hope this did help a little bit?

Cor


Nov 20 '05 #5
Cor
Hi jaYpee,

When I did know that I had not written so much.

I never saw a complete sample like this with an dataadapte.update from
Microsoft, but there is on MSDN enough in snippets.

Therefore is to make that sample yourself as I told less work than
searching for a existing, because when you start with it and look at your
existing you will see you only have to write normaly less than 30 lines of
code

I hope this helps,

Cor

thanks u very much for the support. i have found out that when i
update the dataset it gives me an error telling "dynamic sql
generation is not supported against multiple base tables". since the
dataset contains 4 table so may be this is what the error come from.

by d way i try to use the sample from 101 samples because i want to
have a form like that. it contains a parent form and a two child form.
just like what we can see in the sample database of microsoft access
97 entitled video collection wizard. i don't have any problem creating
this kind of database using microsoft access but i want to migrate to
vb .net and i have trouble learning this new language.

i am very thankful if u can point me to any sample program that
resembles from the sample made by microsoft (ie the 101 sample app)

thanks once again.
Hi jaYPee,

Nov 20 '05 #6
On Sat, 3 Jan 2004 09:32:25 +0100, "Cor" <no*@non.com> wrote:

thanks but i can't find in msdn on how to update the dataset that has
multiple table.
Hi jaYpee,

When I did know that I had not written so much.

I never saw a complete sample like this with an dataadapte.update from
Microsoft, but there is on MSDN enough in snippets.

Therefore is to make that sample yourself as I told less work than
searching for a existing, because when you start with it and look at your
existing you will see you only have to write normaly less than 30 lines of
code

I hope this helps,

Cor

thanks u very much for the support. i have found out that when i
update the dataset it gives me an error telling "dynamic sql
generation is not supported against multiple base tables". since the
dataset contains 4 table so may be this is what the error come from.

by d way i try to use the sample from 101 samples because i want to
have a form like that. it contains a parent form and a two child form.
just like what we can see in the sample database of microsoft access
97 entitled video collection wizard. i don't have any problem creating
this kind of database using microsoft access but i want to migrate to
vb .net and i have trouble learning this new language.

i am very thankful if u can point me to any sample program that
resembles from the sample made by microsoft (ie the 101 sample app)

thanks once again.
>Hi jaYPee,


Nov 20 '05 #7
Cor
Last one today

:-))

update(ds, "table1")
update(ds, "table2")

Cor
thanks but i can't find in msdn on how to update the dataset that has
multiple table.

Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: p-nut | last post by:
newbie here needing some help. Is there a way to set up a script that will check a pop3 account and autosave the file attachments to a folder specified? The thing is: I have 1 single email...
8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
7
by: Dave | last post by:
Are there any add-on products or samples available that can do the following in an vb.net datagrid I want to compare 2 rows in a datagrid - one row from one database and another row for another...
2
by: Groove | last post by:
Hey guys - I've used the Thread.Sleep(xyz) method before to trigger a pause in a sub or function. I was wondering if anyone knew of a method to have a page autosave itself after X minutes? ...
3
by: John Wright | last post by:
I want to create an autosave and crash recovery module for my program. I imagine I would have to use a timer control on the form to call the autosave functionality but I need a starting point. I...
1
by: prinsipe | last post by:
hi all, how can i autosave edited values from my datagrid when the user moves from page to page? i am using template column, textbox is used in item for the user to update the values. is...
2
by: yuvang | last post by:
I have one MDB which is located in server and so many persons are accessing and adding data to that mdb. Here is my doubt 1. is ms access has autosave option? 2. If yes, in what time interval it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.