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

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

Multi table inserts

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :ASP.Net


Please bear with me if this question sounds simple as SQL is definately not my forte.

I want to insert a new record into a table.  The table has relationships with other secondary tables, For example:

Table: Stores

Table StoreCategories (a store can have many of these)

I want to insert a new store, get its ID and insert some categories in one go.

How do I go about this?



View Complete Post

More Related Resource Links

Cutting Edge: Creating a Multi-table DataGrid in ASP.NET


If you bind a multi-table DataSet to a DataGrid, only the first table is recognized. Here Dino Esposito writes a custom solution the the multi-table problem.

Dino Esposito

MSDN Magazine August 2003

wrapping a table into a multi column page

I have a table populated with some data fields that spans 5 pages.  I am trying to set up the layout to be a multi column report (just two columns) in which the table wraps at the end to populate the right section of the page How can this be done?Javier Guillen

Mark columns as Identity in multi-table views?

Hello! When you create a view of one table (i.e. SELECT * FROM Table), it marks the table's identity column as an identity col in the view as well. I have a few that selects columns from several nested tables, but they are all related in a main identity column I select as well, but SQL Server doesn't mark this column as identity, is there a way to do it?Shimmy

How to know the number of columns displayed on the last page for Multi column table

Hi, How will I determine how many columns to be displayed on the last page of the report if I am using a Multiple column table.  I am going to use the number of columns to multiply with the width of the body of the report. I am going to use a Function to get the product. 

15 minute incrementable UTC time inserts in the table


What is the most efficient way of creating a 15 minute increment table. This table needs to continue to increment with time so its not a static table.

While loop? how will that affect the performance, if I have to add dates starting 2005 till today and then basically after that with every hour a value needs to be added.. How can I go about doing that?




Transforming a multi-row notes table into a single-row notes table


Hi guys,

I'm new to SSIS and trying to design a package that will take a multi-row notes table and concatenate it into a single-row notes table. For example, the source fields may include Customer#, Note#, NoteText, Sequence#. In the current format, a long note may be stored in 2, 3, 4 rows. My SSIS package somehow needs to loop through each row, ordered by Sequence#, and concatenate the NoteText field into a single output field. For example:


Customer# Note# NoteText      Sequence#
--------- ----- --------      ---------
1234   1   Example of a multi 1
1234   1   line note.     2
5555   2   Single line note.  3
6666   3   Example of a multi 4
6666   3   line note that spans5
6666   3   three rows.     6


Needs to output the following:


Customer# Note# NoteText 
--------- ----- --------   
1234   1   Example of a multi line note.
5555   2   Single line note.
6666   3   Example of a multi line note that spans three rows. 


Does anyone know what the best method is to accomplish this? I tried using a Script Task and writing it in VB.NET but I wasn't able to figure out how to access multiple rows of data at once. I don't have much experience writing T-SQL Stored Procedures, but I could learn quickly if this is the best method.

Any suggestions?

question about multi rows update in SQL table


Hello, im tryin to do something without success. I have some SQL table with few columns (fileId(int), fileName, copies, color and finish), the page is build in a way, that the user upload few files (the files uploads to some folder, and the fileId and fileName are write to the above SQL table - so the other columns (copies, color, finish) are stay blank - which is OK!!!) after he finished uploading the files he can see the files names in GridView and in that grid view i put some textbox for copies, and 2 DDL for color and comments. I need to update the rows with the new data after the user click some button (the all rows) this is the code:


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
                                        BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataKeyNames="fileId"
                                        Width="100%" Font-Names="Arial" Font-Size="X-Small">
                                        <RowStyle ForeColor="#000066" />
                                            <asp:BoundField DataField="fileName" HeaderText

Quick Launch navigation and Table Of Contents Web Part multi language issues


I noticed that my multi language site have some issues in translations. The translations in breadcrumb, list and libraries are all ok, except the list names in the Quick Launch navigation and the Table Of Contents Web Part, it does not translate the names of lists and libraries......

Can anybody give me some advise? Or is this a bug?


Multi Flatfile to SQL Server table


Scenario: I want to load the data from flat file to SQL server table. Almost 600 log files.

I have Multi flat file as a source and SQL server - OLE DB destination.


I am getting the following errors



[OLE DB Destination [85]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E21.

An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E21  Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".


[OLE DB Destination [85]] Error: There was an error with input column "Column 15" (134) on input "OLE DB Destination Input" (98). The column status returned was: "The value could not be converted because of a potential loss of data.".

[OLE DB Destination [85]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "input "OLE DB Destination Input" (98)" failed because error code 0xC0209077 occurred, and the error row disposition on "input "OLE DB Destination Input" (98)" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error me

Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

Insert value using Table Value Functions

a real gem in Sql Server 2008. mostly people still using Stored procedure may be they shifted to SQL Server but they are not using TVF right now.

Multi-threading in .NET: Introduction and suggestions

This article uses the C# type shorthands throughout - int for Int32 etc. I hope this makes it easier for C# developers to read, and won't impede any other developers too much. It also only talks about the C# ways of declaring variables to be volatile and locking monitors. Developers using other languages can find the equivalents in their own preferred environment, I'm sure.

Using jQuery to Filter Table Rows

The project is using the .net GridView control, so I had limited control over the output HTML code. Still, I think this code can work for most tables. One thing to notice: you should use the class "filterable" on your table or on one of its parents for the code to work.
First, we need a text box:

RadioButton Groups, Table Rows And NamingContainers in asp.net

The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.

RadioButton Groups, Table Rows And NamingContainers

(In which AJAX-enhanced CheckBoxes become more useful than RadioButtons but inheritance saves the day, and a simple RadioButton-derived control establishes the purpose of a control's naming container)

The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.

Building a 3-Tier App with Silverlight 3, .NET RIA Services, and Azure Table Storage

Silverlight 3, .NET RIA Services, and Windows Azure Services Platform makes a 3-tier Cloud application easier to build: Silverlight 3 as presentation tier, .NET RIA services as the business logic and data access tier, and Windows Azure Table as the data storage tier. The sample application in this article demonstrates the architecture with a simple Survey application with all these technologies working together from Windows Azure.

Temporary tables in SQL Server vs. table variables

When writing T-SQL code, you often need a table in which to store data temporarily when it comes time to execute that code. You have four table options: normal tables, local temporary tables, global temporary tables and table variables. I'll discuss the differences between using temporary tables in SQL Server versus table variables.
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