473,396 Members | 1,775 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.

how to insert record from another table to dataset?

as of now i am using a stored procedure from my sql server 2000 to
insert record from another table. what i need now is on how can i
insert record by not using the stored procedure and insert it using
dataset.

here is my code in stored procedure..

CREATE PROCEDURE AddRegularLoad

@SchYrSemID as int, @ProgramID as int, @Sem as varchar(50), @Year as
int

AS

BEGIN

SET NOCOUNT OFF

INSERT INTO SchYrSemCourseJoin ( CourseID, SchYrSemID )
SELECT CourseID, @SchYrSemID
FROM RegularLoad INNER JOIN [RegularLoad Details] ON
RegularLoad.RegularLoadID = [RegularLoad Details].RegularLoadID
WHERE ProgramID=@ProgramID AND Year=@Year AND Semester=@Sem;

END
GO

Nov 20 '05 #1
10 2593
"jaYPee" <hi******@yahoo.com> schrieb
as of now i am using a stored procedure from my sql server 2000 to
insert record from another table. what i need now is on how can i
insert record by not using the stored procedure and insert it
using dataset.
[...]
INSERT INTO SchYrSemCourseJoin ( CourseID, SchYrSemID )
SELECT CourseID, @SchYrSemID
FROM RegularLoad INNER JOIN [RegularLoad Details] ON
RegularLoad.RegularLoadID = [RegularLoad Details].RegularLoadID
WHERE ProgramID=@ProgramID AND Year=@Year AND Semester=@Sem;


IMO, a dataset doesn't make sense here. You don't want to load data into
memory, and that's where the dataset is used for. I think the SP is already
the best solution.
More ADO.Net: microsoft.public.dotnet.framework.adonet

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
"Armin Zingler" <az*******@freenet.de> schrieb
into memory, and that's where the dataset is used for. I think the SP


...what the dataset is used for..
--
Armin

Nov 20 '05 #3
don't know wat u mean...this dataset is used to stored the data from
my table from my sql server 2000. am i right?
On Fri, 23 Apr 2004 10:14:12 +0200, "Armin Zingler"
<az*******@freenet.de> wrote:
"Armin Zingler" <az*******@freenet.de> schrieb
into memory, and that's where the dataset is used for. I think the SP


..what the dataset is used for..


Nov 20 '05 #4
"jaYPee" <hi******@yahoo.com> schrieb
don't know wat u mean...this dataset is used to stored the data
from my table from my sql server 2000. am i right?

I also don't know what you mean. The query copies records from one table to
the other. This is done on the server. I don't see why you need a dataset.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
because when i used stored procedure it is automatically save the data
to another table. while if i don't used the stored procedure i have
the option if i want to save the data or not. by the way this data
will be inserted to the datagrid in my form

On Fri, 23 Apr 2004 11:44:23 +0200, "Armin Zingler"
<az*******@freenet.de> wrote:
"jaYPee" <hi******@yahoo.com> schrieb
don't know wat u mean...this dataset is used to stored the data
from my table from my sql server 2000. am i right?

I also don't know what you mean. The query copies records from one table to
the other. This is done on the server. I don't see why you need a dataset.


Nov 20 '05 #6
"jaYPee" <hi******@yahoo.com> schrieb
because when i used stored procedure it is automatically save the
data to another table. while if i don't used the stored procedure i
have the option if i want to save the data or not. by the way this
data will be inserted to the datagrid in my form


You did not mention what's your intention. Makes it hard to understand.

Yes, you can load the data in a dataset and bind it to a datagrid. Later you
can store the changes to the database. I'm not sure what's exactly your
problem. Here's the entry for using Datasets and data binding:

http://msdn.microsoft.com/library/en...ngdatasets.asp
http://msdn.microsoft.com/library/en...riDatasets.asp
http://msdn.microsoft.com/library/en...chitecture.asp

See also the already mentioned ADO.Net group for ADO.Net specific questions.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
Nov 20 '05 #7
Hi jaYpee,

To give you Microsoft samples is difficult as I said because they all go not
farther than the fill, you seldom see them complete with the update.

Try to find this things
You need a connection (which you have already)
A dataadapter
A dataset.

The dataadapter is a class which does a lot for you.

When you use with that the
commandbuilder, than you are for the start very happy.

What you do
You make the connection.
You fill your dataset using the dataadapter
You bind that to your dagagrid (I asume all is windows forms)

The changes are done and you do
currencymanager.endcurrentedit (this is not the complete code)

Than you look if the dataset has changes
if dataset.haschanges
dataadapter.update(dataset)
end if

And all this you use in try and catch blocks.

Than your data handling is almost done.

I hope this helps someting?

Cor
Nov 20 '05 #8
Hi I forgot to say if you have more detailed questions feel free to ask?

Cor
Nov 20 '05 #9
my purpose is this. i have 2 datagrid in my form. the 2nd datagrid is
related to the 1st datagrid. now in my 1st datagrid there is a
checkbox that when i click that i want to fill the 2nd datagrid w/
records from another table. i have successfully done this in ms-access
and don't know how to do this w/ vb.net

anyway here's the code i used in ms-access when the value of checkbox
is equals to true.

DoCmd.RunSQL "INSERT INTO SchYrSemCourseJoin (
CourseID, SchYrSemID ) " _
& "SELECT [RegularLoad Details].CourseID, " &
Me!SchYrSemID & " " _
& "FROM RegularLoad INNER JOIN [RegularLoad
Details] " _
& "ON RegularLoad.RegularLoadID = [RegularLoad
Details].RegularLoadID " _
& "WHERE (((RegularLoad.ProgramID)= " &
Forms![Students]![ProgramID] & ") AND (RegularLoad.MajorID= " &
Me!MajorID & ") AND ((RegularLoad.Year)= " & Me!Year & ") AND " _
& "((RegularLoad.Semester)= '" & Me!Sem & "'));"

the table regular load and regular load details is related to each
other and is act as a template to the table schyrsemcoursejoin.

pls tell me if i did not explain better.

thanks for the help

On Fri, 23 Apr 2004 14:45:07 +0200, "Cor Ligthert"
<no**********@planet.nl> wrote:
Hi I forgot to say if you have more detailed questions feel free to ask?

Cor


Nov 20 '05 #10
Hi jaYPee,

There are two methods (It is not standard) for using a combobox in a
datagrid.

The one is with a combobox and the otherone is with a comboboxcolumn, which
one are you using?

Although it is again a long time ago that I did look at that, so my help
will be probably very fair.

Cor
Nov 20 '05 #11

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

Similar topics

1
by: Yog | last post by:
I have a datagrid binded to a dataset and once the user updates the grid my dataset is reflected. When i wanted to save the data to tables, however i needed to insert this data into another...
3
by: Steven Stewart | last post by:
Hi there, I have posted about this before, but yet to arrive at a solution. I am going to try to explain this better. I have an Employees table and a Datarecords table (one-to-many...
8
by: Carl | last post by:
Hi, I hope someone can share some of their professional advice and help me out with my embarissing problem concerning an Access INSERT query. I have never attempted to create a table with...
1
by: Abareblue | last post by:
I have no clue on how to insert a record into access. here is the whole thing using System; using System.Drawing; using System.Collections; using System.ComponentModel;
4
by: authorking | last post by:
I use the following code to insert a data record in to a datatable of an access database.But every time I execute the command, there will rise an exception and the insert operation can't be...
4
by: Mike Hnatt | last post by:
My goal is to get data from an XML file into a couple of tables in an Access database. The XML file is a little complex so I need control over what I do (I can't just read it into a dataset). ...
0
by: Eustice Scrubb | last post by:
In line coding problem. Here's my code: <script language="VB" runat="server"> Dim myConnection As SqlConnection Sub Page_Load(Src As Object, e As EventArgs) ' Create a connection to the SQL...
13
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever...
3
by: RN1 | last post by:
This is how I am trying to insert a new record in a database table & then display all the records (including the newly inserted record) in a DataGrid: <script runat="server"> Sub...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.