.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Updating multiple tables simultaneously

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
Hi all, Was wondering if someone can help me out with this multi update problem I have a webform that populates a single table but due to certain dropdown data conditions it could also potentially populate 3 other tables The tables information populates a gridview with amounts from accounts etc.. e.g. Table 1 Site          DataType            account           update 34                  SS                       12.50              N Table 2 Site             account 34                    12.50   Say the above entry has the updated column changed to Y via the webform the amount 12.50 should disappear from the gridview. I was a bit shortsighted and added the additional tables afterward. The information on the gridview pulls from the additional tables and since the first table and the additio

View Complete Post

More Related Resource Links

merging multiple tables in a single dataset to single table


 i have a stored procedure which returns three tables to a dataset ..... now i need to merge all three tables to a single table from d same dataset 

like dataset1 has table1 table2 and table3 .... i want all the three tabels to be merged into dataset1 itself .... instead of three diffrent tables so that i can show all three table data in a single datagrid  as a compact data and combination of 3 tables from d single dataset.....

can some1 help me please.....

SUM col from multiple tables

I am trying to SUM a column from each of 3 tables, where an ID field is the same in each table and the date range is the same also It would look something like this: table1      table2      table3      table4  amt         amt         amt         t4ID  ID           ID           ID  date        date        date SELECT SUM(t1.amt),SUM(t2.amt),SUM(t3.amt) WHERE (each table).ID = @t4ID AND (each table).date BETWEEN @date1 AND @date2 the t4ID, date1 and date2 will be chosen by the user from controls and supplied to the statement via a parameter array. I have tried many variations ( with more to go) to send 1 @t4ID parameter, for example, and use that in all 3 tables (same with the dates). Any help to nudge me in the right direction would be appreciated. Thanks

Rename a column in multiple Tables using sp_rename

Hi,Any work around for the below issue?Originally "LoadDate" column (see below scripts) was there both in tables DIM_Table_1 and DIM_Table_2According to change in requirement, LoadDate in both the tables to be chnged to LOAD_DATE. It has to be done through script-----------------EXEC sp_rename 'dbo.DIM_Table_1.LoadDate',     'LOAD_DATE', 'COLUMN'         -- Successfully executedEXEC sp_rename 'dbo.DIM_Table_2.LoadDate',     'LOAD_DATE', 'COLUMN'         -- Error: See below Error: The new name 'LOAD_DATE' is already in use as a COLUMN name and would cause a duplicate that is not permitted.-----------------

extracting from multiple tables in an odbc call/ssis

Hi,   I have an odbc for DBISAM, and can use it to import into sql server, but only one table at a time.  (when it get's to the choose table screen, it will only let me create a single SQL query.   does anyone know if I can extract from multiple tables using this?   If not - what would I need to change in the DTSX file so that my query goes from "select * from tablea" to "select * from tableb" and the destination table is also "tableb"?   also - can the DTSX file be change to run for multiple tables?

Using Multiple Tables in RDLC

I need to use multiples tables in a RDLC report. First table is AuditReport And Second table is CostPerUser But in Report Viewer we can only set dataSource Name to one table like thisReportDataSource dataSource = new ReportDataSource(); dataSource.Name = "DataSet10_AuditReport"; dataSource.Value = ds1.Tables[0]  So how we can use other table...... Pls rply  

Delete from multiple tables

 After trying myriad ways to accomplish deleting from two table, I found a way that actually works. However, AM am sure there is a better way to do this. Any ideas?  Imports System.Data Imports System.Data.SqlClient Imports Telerik.Web.UI Imports System.CodeDom Imports System.Web Partial Class Default2 Inherits System.Web.UI.Page Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sql As String Dim strConnString As [String] = System.Configuration.ConfigurationManager.ConnectionStrings("CF_SQL_Connection").ConnectionString() sql = "DELETE FROM Table1 WHERE IDTable1 = '5'" Dim connection As New SqlConnection(strConnString) Dim command As New SqlCommand(sql, connection) command.Connection.Open() command.ExecuteNonQuery() command.Connection.Close() Dim sql1 As String Dim strConnString1 As [String] = System.Configuration.ConfigurationManager.ConnectionStrings("CF_SQL_Connection").ConnectionString() sql1 = "DELETE FROM Table2 WHERE IDTable1 = '5'" Dim connection1 As New SqlConnection(strConnString) Dim command1 As New SqlCommand(sql1, connection) command1.Connection.Open() command1.ExecuteNonQuery() command1.Connec

Excel data into multiple tables

Hi,       I  have excel file with columns EmpName,Date1,Date2,...Date7 .I want to insert EmpName into Employee table after inserting i will get EmpNo(Identity column) with that  i need to insert Date1,Date2...Date7 into TimeSheet table.    My Excel structure is like this EmpName  8/1/2010      8/2/2010     8/3/2010       8/4/2010    8/5/2010    8/6/2010 8/7/2010 Naresh    17:00-2:00   17:00-2:00   14:00-12:00  7:00-12:00  7:00-12:00  ..               Off Similarly 500 employees data I want to insert name i.e into Emp table after inserting i will get EMpNo i.e identity column with that i should insert Date1(8/1/2010) i.e excel header to date7 into Timesheet table Date column and corresponding time into TimeIn and TimeOut.I will split the time.I just want write Stored procedure for this task. My database tables are like this Emp-EmpNo,EmpName,CompaignId Timesheet-TimeID,EMpNo,Date,TimeIn,TimeOut,TotalHours   Date in Timesheet should be like this   TimeId     EmpNo     Date       TimeIn     TimeOut 

Most Recent records from one of the table among the tables in multiple joins.


Hi All

I have a single select query with multiple table joins in it.

I want to retrieve the Most Recent records from one of the table among the tables in multiple joins.


(select t1.col1, t2.col2 , t3.col3, t4.col4, t4.Add_Date,t5.col5,

from dbo.table1 t1

left outer join dbo.table2 t2 on t1.col1=t2.col2

left outer join

(select col3 from dbo.table3 where condition1="expr") as t3

on t1.col1=t3.col3

left outer join dbo.table4 t4 on t1.col1=t4.col4 order by t4.Add_Date

left outer join dbo.table5 t5 on t1.col1=t5.col5 )

Problem is that, I am not able to use the "Order by" for a particular table.



Insert/Update data to multiple tables on a single button click


Hi experts,

I need to insert/update data to 3 or more tables on a single button click.What is best method for achieving this?I am using mysql as my DB.

Thanks for your valuable reply in advance.

how to delete records from multiple tables.


Hi Friends,Tell me How to delete records from multiple tables by using a single query.

ForeignKey to Multiple Tables ? ? ?


This is probably a "dumb" question but gotta ask it anyway:
Is it possible for a certain column from TableA to point to the PK of TableB OR the PK of TableC????


PersonID int PK
Name varchar(50)
PetID int (FK)

TableB: CAT
CatID int PK
SleepsAlot bit
Name varchar(50)

TableC: DOG
DogID int PK
NumberOfTeeth int
DogYears int
Name varchar(50)

A "PERSON" should ALWAYS have a Pet associated, but it can be a CAT or a DOG or any other ANIMAL t

Updating Multiple records at 1 time.


You got to love management, they can never make their minds up on what they want. 

I'm currently working on a asp.net project using a datagridview that acts for the most part like a spreadsheet.  What I have to do now is update all the values in the table from the selected date, hour, min, max and cost forward.  There are 7 days worth of data in the table, when the user alters either the min, max or cost I need all the values in that field from that point onward to have the new altered value.

Here's an example:

In hour 10 of the day the user want to increase the max from 5 to 19, the min stays the same and so does the cost.  Mind you any or all of these values could change.  The only once that will remain as-is is the Date and Hour field:


Date Hour

Multiple Tables needed for Report Builder Problem


I have 3 tables I need to join: Voucher, Voucher_Detail, and Place
Voucher is related to Voucher_Detail by column voucher_run_id
Voucher has no relationship to Place
Voucher_Detail is related to Place by column place_id

I have solved the one to many relationship problem I was having between Voucher and Voucher_Detail by adding a New Named
Query called LeftOuterJoin.

In my DSV, the Voucher table links to the LeftOuterJoin which links to the Voucher_Detail which links to the Place

When I go into Report Builder, as soon as I select Voucher_Detail ( which is the table that has the most columns I need in the report),
the Voucher table disappears from view.

Not sure what I have missed. Obviously I need access to all 3 tables' data.

Multiple Tables on One Page, One Dataset



In SSRS 2005, is there a way to have 2 tables on a page, each displaying a row of data from the same dataset?

In other words:

Page 1, Table 1 data = row 1

Page 1, Table 2 data = row 2

---- new page ----

Page 2, Table 1 data = row 3

Page 2, Table 2 data = row 4

and so on?

deleting records from multiple tables at once in SQL Sever 2005


DELETE Users, meet, tour FROM Users, meet, tour WHERE Users.uid=meet.desg AND meet.desg=tour.desg AND Users.uid='CCC';

i have try this command to to delete record from three table

i want to delete all the record of uid from user ,tour and  meet at once.

Users table having a key uid which is common to all table.

 in table Users, uid is primery key

and meet table having desg and tour having desg common field value

i.e. Users.uid=meet.desg=tour.desg are same desg in both table is foreign key

so how could i delete uid from Users table ,desg from tour and meet at once and all the record from these 3 tables

Saving records in to multiple tables!


hi friends,

im not that familar with xml but im stumple across the problem that i cannot save 1: M relationships when i have to save more than column in the a child table. else could use csv and i could save off one column. But when i have save more than one column in ths second, third...etc i cannot think of anything else than xml.. but im familar with xmal and xpath, xquery all that.

So is there a popular atechnique that the developers use to save records into multple table than use of xml?



Importing multiple files to multiple tables in SSIS


I have a directory with 200+ txt files to import into SQL tables in a database. Each file name is the exact table name in the database(without the file extension, obviously). I am looping through each file with a for each loop and a variable is mapped and set in the source connection properties for the Expressions -> ConnectionString property, so each name will go into that variable without the file extensions, correct?  Now, I set the variable name to the table name in the destination for the table name under "Data Access Mode", but it is giving an error...do I have to assign variables to each part, (Connection String and Name)? Does anyone have a quick setup for this?



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend