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


Post New Web Links

inserting same dataset but they may be sorted differently

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :Sql Server
 

Please try to follow this scenario.

I have an empty table that has a PK made of several columns, with a clustered index defined on them. I insert some data into this table and it takes, say, 1 minute.

Next, I empty the table and do the same insert. The data volume is the same, and even the data content is the same. The only difference is that the data may be in a different order. This insert takes way more time, say like, 20 minutes.

So, I guess the order in which the data is sorted makes a difference when inserting to a table that has a clustered index. Am I correct about this?

Depending on the answer, I have some follow up questions.

 




View Complete Post


More Related Resource Links

inserting same dataset but they may be sorted differently

  

Please try to follow this scenario.

I have an empty table that has a PK made of several columns, with a clustered index defined on them. I insert some data into this table and it takes, say, 1 minute.

Next, I empty the table and do the same insert. The data volume is the same, and even the data content is the same. The only difference is that the data may be in a different order. This insert takes way more time, say like, 20 minutes.

So, I guess the order in which the data is sorted makes a difference when inserting to a table that has a clustered index. Am I correct about this?

Depending on the answer, I have some follow up questions.

 


Inserting new row in GridView in ASP.NET 2.0

  
The GridView was not designed to insert new rows, but there is a way to accomplish this with very little code. This article shows how to do that. The GridView was not designed to insert new rows, but there is a way to accomplish this with very little code.

Introducing ADO.NET and the Typed DataSet

  
In reviewing the applications it seemed everything they were doing involved database reads, writes, and manipulation. The development staff had been reviewing the articles and code samples for ADO.NET. They had spent many years refining their existing ADO based infrastructure and perfecting their use of ADO

Create and Use a Typed DataSet by Using Visual C# .NET

  
This article shows you how to create and use a typed DataSet in a small Web application. Typed DataSets, which inherit from the DataSet class, create first-class members of a DataSet's DataTables and DataColumns, yielding the many benefits that come with the use of strong typing.

Get Top 1 Record from Dataset

  
Many of them in need of getting the Top 1 or Top 10 records from a Dataset without going to SQL query. It is possible to do from Code Behind. I have given the code below,
The below code is to get single record from a Dataset. Also I have given for getting 8 records at Green Color.

Returning a DataSet From a Web Services: Step-by-Step

  
This Example Shows how to create a webservice which returns a DataSet and a Client Which displays the DataSet in a Grid.

Description

This Example Shows how to create a webservice which returns a DataSet and a Client Which displays the DataSet in a Grid.

Inserting personal error message in ValidationSummary

  

Hi,

I am creating a web form that requires a lot of validation. I use many of the validation control in asp.net already like RequiredFieldValidator and CompareValidator. 

My Problem: after my custom validation for the value entered return an error message, and I pressed enter key when the field is empty, my custom error message is overlapped by my ValidationSummary. 

Setting my custom error to visible = false on button click also does not seem to work as it requires for me to enter the value first.

This made me think, is there a way to insert my custom validation inside the ValidationSummary as an error message like for other validation control?

Thanks in advance


Inserting rows via stored procedure and under certain conditions

  

I'm using Dynamic Data with Entity Framework in VS2010.

Let's say my table has these fields:

MyTable
ID (PK)
PersonID (FK)
LocationID (FK)
TotalItemsSold

Hypothetical scenario (it's easier for me to explain this way, so just bear with me for now)... But let's say each row in the table represents "how many items were sold by such-and-such employee at such-and-such location," where location and person are foreign keys which are referencing other tables.  Basically, there should be no more than a ONE row which has a particular combination of Person and Location.  Makes sense?

So, when inserting new rows using my Dynamic Data app, the insert form displays editable fields for Person (dropdown), Location (dropdown), and Items Sold (textbox).  How do I prevent users from inserting another row into the table containing an already-existing combination of Person and Location?   How do I displaying useful feedback to them in the event that they DO attempt to do this?

I have several thoughts about this, but since I'm new to Dynamic Data, I'm not sure which way to go.  For example:

Option 1:  Use "cascading dropdowns" approach in the insert form and only pull in the "allowed" combinations of the two dropd

Persist large dataset across ASP.NET pages. No database

  

Can anyone give me suggestions on how to implement the following requirement?

1. A online wizard (step-by step operation) processes user requests across several ASP.NET pages.  The session data is stored in memory until the user submits the request.  Once the request is submitted, a XML file is created and the data are passed to XML.

# Case Study: The parent page has a "select" button.  Click "select" will pop up a child page.  The users can select 1000+ items from a datagrid in the child page.  Once the user clicks "confirm", the selected items in the child page will be populated to the selected item gridveiw in the parent page.  The user can keep selecting more in the child page and the selected items will be appended to the gridview in the parent page.

Questions:

- What's the best way to extract strings from a text file and convert to a dataset in memory and then present it in a datagrid in UI?

- What's the best way to persist and manipulate a large dataset across pages?  Session? or ViewState? Can it be accomplished by LINQ?

The app doesn't interact with a DB.  Once the request is submitted, it will convert the in memory data to a XML file.  What technology can be used to accomplished this?&nb

Why not Dataset use to Saving?

  

Hie Friends,

I have searched on net and even i worked on 2 huge shipping projects.

Everywhere i found that while binding data to control use dataset but when we save, they recommend use command (use generic collection and create command object with store procedure) why not we use dataset as in .NET 2.0 it is improved lot and data adapter has new feature batchupdatesize.

why we need to create property page which maps to all column in a database.

E.g. if i have employee table with empid and empname in database then i use to create emp.cs with properties of empid and empname and use same properties for saving. If i use these properties for validation in business rule then no problem. But why we use them in saving for creating command object.

Thanks.



LINQ to SQL - Validating if item is in Database, but if item is not items not inserting into databas

  

Hello,

I am new to this, so bear with me.  I am writing an application in C# that uses LINQ to validate a datacontext off a textbox to see if the record exists already.  If the record does exist I inserted an if statement to advise the user that the record exists, if the record does not exist I would like to allow the record to be added to the database.  If I take out my else statement everything works fine as far as inserting goes, but I do not want to allow inserts in this scenario.  I have tried moving the if and else statement to different parts of the code but can't quite figure this one out.  Any help would be apprecaited, attached is the code.  This code is set to a button press.  As a matter of fact, if you see any other errors along the way please feel free to point them out. 

Thanks,

Pete

    protected void enterBTN_Click(object sender, EventArgs e)
    {
        //make new data context

        SHCDataContext insNewAll = new SHCDataContext();
 
        //LINQ to check if customer exists in database
        var checkExisting = from c in insNewAll.Customers
                            where c.custLastName.Contains(custLastNameTB.Text.ToString())
                            select c.custLastName;
        //make list to store values
        L

DAL Dataset showing all the column

  

I follow the tutorial and create DAL with Dataset. I created a Table Adapter with many column, but when i Call a simple Get for 2 column only. The system display 2 column and the rest column with empty data.

My question is that will this affect the performance? because i only need 2 column.

example: Table with 40 column define in Dataset in DAL. I have GetMember from Dataset with 40 column, some request only 1 column (with 39 empty), some request 22 column (with 18 empty column). Will this affact the performance?


Should i create a seperate DatasetAllColumn, Dataset1Column, Dataset22Column ?? so system only return exact column i need. and hofully the performance is optimized to it best.


inserting from gridview footer

  

I have been following the tutorials from Scott Mitchell on this site.  I am trying to insert a new record from the gridview footer.  I have my BLL set up as a .cs class in the App Code folder.  When I fill in the fields and click add, nothing happens.  The page refreshes and the text boxes empty, but nothing is added to the database.  The edit and delete functions work fine.  Have I put something in the wrong spot?

 

I have the rowcommand and the datasource_inserting on the code page as below.

protected void Oems_RowCommand(object sender, GridViewCommandEventArgs e)
{
    // Insert data if the CommandName == "Insert" 
    // and the validation controls indicate valid data...
    if (e.CommandName == "Insert" && Page.IsValid)
    {
        // TODO: Insert new record...
        OemsDataSource1.Insert();
    }
}


protected void OemsDataSource1_Inserting
(object sender, ObjectDataSourceMethodEventArgs e)
{
    // Programmatically reference Web controls in the inserting interface...
    TextBox txtOem = (TextBox)GridView1.FooterRow.FindControl("txtOem");
    TextBox txtOemStreet = (TextBox)GridView1.FooterRow.FindControl("txtOemStreet");
    TextBox txtOemCity = (TextBox)GridView1.FooterRow.FindControl("txtOemCity");
    DropDownList

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.....


Inserting data to ExcelSheet

  

Hi all,

I have a web form, in that i'll enter daily expense details.

After i press save button, the data i entered are saved into an excel sheet.

I don't have idea how to save the data to excel sheet, so your help for this greatly welcome. 


Reading data from .doc or .docx and inserting into db

  

Hello,

A vendor is providing content which needs to be inserted into the db. The content is basically questions with options and explanations. An example is below.

=========================================

Export Dataset to excel sheet in a required format?

  

Hi,

I know how to export a grid view to excel.

But here i have a Dataset which consists of data like below and also it need to display in a required format like below.

pno psubno pstate pdetailid pdetails

 12    1          CA         1           cbsdjcbdjc     

12     1          CA          2        cndcnjdcjcj

12     2           VA         4          xcndwkfcgygry

13     1            AL        1           ncdcnjdcndj

My excel sheet  should like this.

pid       pstate     

 12/1      CA             &nb

Categories: 
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