CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_web_developer_2005_express Tags:
Item Type: NewsGroup Date Entered: 5/24/2007 6:39:34 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 6 Views: 26 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
7 Items, 1 Pages 1 |< << Go >> >|
rambo_20uk
Asp.Net User
How to select & insert data in the same table5/24/2007 6:39:34 PM

0/0

Hi

   I have a table called Version and its attributes are Version_ID, Project_ID , Hospital_ ID , Date_Created and comments. I want to select the data by Version_ID,Project_ID and  Hospital_ID and the selected data is inserted in the same table(Version) as new row .

Table: Version (Version_ID(Primary_key), Project_ID(Foreign_Key),Hospital_ID(Foreign_Key),Date_Created,Comments). 

Iam using Visual Web Developer Express and SQL Server 2005. Iam doing on asp.net 2.0.

Could anyone please send me the code asp.net 2.0 for the above problem.

perthit
Asp.Net User
Re: How to select & insert data in the same table5/24/2007 7:15:03 PM

0/0

Dear,You can have multiple SQLCommand objects, one for selecting the data and one for insertion of the selected data, You can also do it with only one command object, just select the data and populate a DataSet, the change the CommandText or Stored Procedure of the SqlCommand Object for the insertion section. Hopefully it will work for you.Kind Regards
Shahid Khan
http://www.PerthIt.net

 

gcalderon
Asp.Net User
Re: How to select & insert data in the same table5/24/2007 8:58:11 PM

0/0

Where are you selecting the data from? Do you simply want to add a new row to a data set and then perform a database update? This would be the easiest approach.


 

rambo_20uk
Asp.Net User
Re: How to select & insert data in the same table5/24/2007 9:19:39 PM

0/0

Gcalderon thanks a lot for reply

Actually i want to select a row from the version table for example Version_ID (1004) and i want to insert that selected row into the same table(Version) as new row for example Version_ID (1007).

Table: Version (Version_ID(Primary_key), Project_ID(Foreign_Key),Hospital_ID(Foreign_Key),Date_Created,Comments). 

If you don't mind could you please give me the solution in detail.I'll wait for your reply .

gcalderon
Asp.Net User
Re: How to select & insert data in the same table5/24/2007 9:26:35 PM

0/0

I'm having difficulty understanding what your trying to accomplish from a user point of view.  Are you dealing with a gridview? Do you want the user to click on a row to get the data or do they simply type it in somewhere and then add it to the database. Explain from a user point of view, what are the steps?

rambo_20uk
Asp.Net User
Re: How to select & insert data in the same table5/25/2007 2:33:20 AM

0/0

Hi gcalderon

                  My webpage contain three dropdown box and one button. One dropdown to choose hospital_id, second dropdown to choose project_id and third dropdown to choose version_no .After choosing these three and when the button is clicked i want to run this sql query

INSERT INTO  version(project_id,hospital_id,date_created,comments) SELECT project_id,hospital_id,date_created,comments FROM version where version_no=@version_no and project_id=@project_id and hospital_id=@hospital_id.

Just i need the code in asp.net 2.0 , VB , when the button is clicked the above query should run and the parameters (values) should take from dropdown box.

Please send the solution for the above problem. I'll wait 4 ur mail.

 

bolinc
Asp.Net User
Re: How to select & insert data in the same table5/25/2007 4:24:45 PM

0/0

The easiest way would be to put your insert query into a datasource. Then on the button OnClick event put

sqldatasource.insertparameters["@version_no"].defaultvalue = dropdownlistVersion_no.selectedvalue;

sqldatasource.insertparameters["@project_id"].defaultvalue = dropdownlistProject_id.selectedvalue;

sqldatasource.insertparameters["@hospital_id"].defaultvalue = dropdownlistHospital_id.selectedvalue;

sqldatasource.insert();

The syntax might be a little bit different as I use C#, but that is what you need to do.

 

7 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Beginning MySQL Authors: Robert Sheldon, Geoff Moes, Pages: 840, Published: 2005
Sams Teach Yourself SQL in 24 Hours Authors: Ronald R. Plew, Ryan K. Stephens, Pages: 472, Published: 2002
SQL: A Beginner's Guide Authors: Robert Sheldon, Forrest Houlette, Pages: 560, Published: 2003
SQL Anywhere Studio 9 Authors: Breck Carter, Inc NetLibrary, Pages: 0, Published: 2004
Professional SQL Server 2005 Programming Authors: Robert Vieira, Pages: 884, Published: 2006
Web Database Applications with PHP and MySQL: Building Effective Database-Driven Web Sites Authors: Hugh E. Williams, David Lane, Pages: 796, Published: 2004
The Practical SQL Handbook: Using SQL Variants Authors: Judith S. Bowman, Sandra L. Emerson, Marcy Darnovsky, Pages: 469, Published: 2001
Managing and Using MySQL Authors: George Reese, Randy Jay Yarger, Tim King, Hugh E. Williams, Pages: 425, Published: 2002
MySQL in a Nutshell Authors: Russell Dyer, Pages: 545, Published: 2008
Beginning SQL Server 2005 Programming Authors: Robert Vieira, Pages: 688, Published: 2006

Web:
Can't I select and insert data into the same table in PHP? cant i select and insert data into the same table in php?
SQL SERVER - Insert Data From One Table to Another Table - INSERT ... New table is created with same data types as selected columns. USE AdventureWorks GO ----Create new table and insert into table using SELECT INSERT SELECT ...
Insert (SQL) - Wikipedia, the free encyclopedia Nov 21, 2008 ... The subselect can contain joins, function calls, and it can even query the same table into which the data is inserted. Logically, the select ...
MySQL :: MySQL 5.0 Reference Manual :: 12.2.5.1 INSERT ... SELECT ... Currently, you cannot insert into a table and select from the same table in a .... I wanted to insert some data and refer to other tables for referential ...
Inserting data into a temporary table Inserting data into a temporary table. Question. Create a temporary table to hold daily and cumulative sales totals for clothing products. Issue a SELECT ...
Refresh a table of data after inserting or deleting a row using ADF Select a row from a table of data, click a button to delete the row, and remain on the same page. The table of data should be refreshed so that the deleted ...
Transact-SQL User's Guide The select clause can insert values into some or all of the columns in a row. ... You can insert data into a table based on other data in the same table. ...
Insert data into empty table I created an empty table (property_copy) with the same structure as the first table, but when I wanted to insert the data from the first table (property) to ...
SELECT from INSERT: New SQL Function in System i V6R1 | System ... Sep 1, 2008 ... Assuming the same ORDERS table as in Figure 2 and a second table named QUEUE ( Figure 5), insert data into the ORDERS table from the QUEUE ...
MySQL - A difficult INSERT...SELECT on the same table [MySQL 5.051 ... I am trying to insert a new row into my table which holds the same data as the one I am trying to select from the same table but with a different user_id ...

Videos:
Dreamweaver: Basics Start with the basics in using DreamWeaver to create your web site.
A Googly MySQL Cluster Talk Google TechTalks April 28, 2006 Stewart Smith Stewart Smith works for MySQL AB as a software engineer working on MySQL Cluster. He is an ...
An Introduction to SQLite Google TechTalks May 31, 2006 Richard Hipp ABSTRACT SQLite is a small C library that implements a self-contained, embeddable, zero ...




Search This Site:










orcas beta 1 on lh server and iis7

how to copy user names from ad and place them in sql server

have a problem with a width of pages

smart-thinker modules - the best value?

numbered sub-directories

multiple versions

error message - wierd

bug? : manage users tab : delete unauthorised users..

will pay for dnn pa development

restricting modules

solpart menutype

check the windows user membership in module

the new memberrole.dll that is coming in the final release

creating custom tags with aps.net

dragging absolutely positioned items with cursor

need to know how to set source code location

phantom menus

redirecting to "no access" page

child portal error with variable "glbdefaultpage"

request - original (retired) portalcsvs code

"control cannot be added because visual studio cannot find the control's type in the control assembly".

make enter key execute the login action

active directory authentication method.

dbnull to type integer is not valid error message

dnn 3.0.12 - source vs pre-install deployment-version sizes

help me on forum

first step to design the skin

adding control to custom control

custom m-ship provider - hide/disable base functions/subs

problems with release version of application.

 
All Times Are GMT