.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

dataset table adapter commands

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :Windows Application


how i can disable generation of insert update delete select commands in tableadapter or how i can

remove all of these commands in dataset?


tank u in advance

View Complete Post

More Related Resource Links

stored procedure or table adapter commands


hi friends

in my windows application i used a dataset and populated it with tables by dragging tables from server explorer, and for each table's table adapter i added four stored procedures that i have created in sql server while dataset generator generates insert, update , select , delete commands for each table adapter. i want to know whick one is better, using stored procedure or using dataset generated commands?

tanks in advance


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

SQLCE table column DefaultValues don't show up in XSD Dataset designer

Using Visual Studio 2008 with SQL CE 3.5, I notice that default values in the creation scripts for the database tables are not reflected in the dataset designer XSD file.  For example, the following SQL script creates the non-nullable table column names "Content" with a default value of 'Image':    "Content" nchar(20) NOT NULL DEFAULT 'Image',But in the column properties of the dataset designer (XSD) panel, this column correctly shows up as non-nullable, but with a DBnull default value as follows:     Name: Content    Allow DBnull: False    DefaultValue: <DBnull>Am I missing something somewhere, or is this a VS bug?  Also, how do I get the XSD file to regenerate after schema changes in the database?  Sqlmetal doesn't do it.Thanks,    -BGood

C#: How to add a row to a child table with a DataSet backing?

On the back end I am using XML files, xsd schemas a DataSet(dsThingPrograms) and DataTables. I have a parent ->child table relationship defined through the DataSet designer as such:   things[RFID(pkey), name] programs[ID(pkey/autogen), name, path, thing_RFID(FK references things->RFID)]   In my code I have:   dsThingPrograms.things.AddthingsRow("lala" , "00ffe4" ); dsThingPrograms.things.WriteXml("path\to\things.xml" , System.Data.XmlWriteMode.WriteSchema);   which works fine. However the problem comes when I try to add a row to the Programs table. When I do:   dsThingPrograms.programs.AddprogramsRow("someprog" , "some\path" , <???>);   VS wants me to add a "dsThingPrograms.thingsRow parentthingsRowByFK_things_programs" where the <???> is. I've tried a bunch of things but I could not satisfy that requirement and can't even get the code to compile. What is supposed to go in there to satisfy the FK property?

Table Adapter generates bad SQL under load

I have an application (ASP.NET 2.0/SQL Server 2005) which makes heavy use of table adapters for pulling records from SQL. Under heavy load, we get a lot of SQL Server Timeout errors. We have run a trace on SQL Server and it shows that several of the SQL statements being passed into SQL Server, from the Table Adapters, have bad SQL. For example, here is the SQL in one of the table adapters SELECT    HomeMsgID, messageName, messageHTML, messageText, populationID FROM        MyUCR_HomeMessages WHERE    (populationID IN                           (SELECT    populationID                             FROM          MyUCR_Population_CPID AS MyUCR_Population_CPID_1                             WHERE      (CPID = @CPID))) AND (isVisible = 1) AND (showDate <= @showDate) AND (removeDate >= @removeDate) I call it with the following: DateTime showDate = DateTime.Today; DateTime removeDate = DateTime.Today; myUCR_HomePageMsgsTableAdapters.MyUCR_HomeMessagesTableAdapter ta = new myUCR_HomePageMsgsTableAdapters.MyUCR_HomeMessagesTableAdapter(); myUCR_HomePageMsgs.MyUCR_HomeMessagesDataTable dt = new myUCR_HomePageMsgs.MyUCR_HomeMessagesDataTable(); ta.FillByCPID(dt, showDate, removeDate, CPID); What the SQL trace shows, when it fails, is this (notice the extra single quotes around the showDate, removeDate parameters): E000 exec sp_executesql N'SELECT    HomeMsgID, messageN

setting schema as dataset to a table

hiii have an already existing schema (in a xsd file). now i need to prepare a report, so in the rdlc page i take a table. now how can i set the schema as a dataset to the table?(i'm getting an error -- "the table 'table1' is in the report body but the report has no data set.  Data regions are not allowed in reports without datasets.").  

Dynamically fill query parameters in a table adapter ?

SO I have created an object data source on a page from a table adapter using the various Wizards in Visual Studio.Its meant to query a diary Database by a DateTime parameter called diaryDate. I want to query from a date Now to the next 14 days ahead.I want to display the entries in a Grid View when the page loads.So I'm a bit stuck now as to how to set the two query parameters date1 and date2. I want to set date1 = now() and date2 = now() + 14 days.How do I set those parameters when the page loads ?Should I have used the adapter Wizard approach of do I have to write all the code in the code behind page ??This is my datasource code'<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GET_nextTwoWeeks" TypeName="query_getNextTwoWeeksTableAdapters.diaryDatesTableAdapter"> <SelectParameters> <asp:FormParameter DefaultValue="" FormField="date1" Name="date1" Type="DateTime" /> <asp:FormParameter DefaultValue="" FormField="date2" Name="date2" Type="DateTime" /> </SelectParameters> <InsertParameters>

Arrange columns from nested table in a dataset that writes into XML file



I have 3 related data tables. I added these tables into a dataset and finally write it to a XML file. But the related columns from table 2 and 3 is appended after all the columns from table 1. How can I have something like:
in a dataset that I write to XML instead of

isdbnull() table adapter


Hi, was hoping someone could help.  I have a sqltableadapter with a select query, and am trying to popluate textboxes from the data retrieved.  All is well until  I come to a null value.   I've tried to check for isdbnull, in an if statement. 

' usr is defined earlier

Dim strfirstname As String = ""

Dim usrinfo As New sqlTableAdapters.UserInfoTableAdapter

                Dim mydatatable As sql.UserInfoDataTable = Nothing

                mydatatable = usrinfo.GetDataByUserID(usr)

                If Not IsDBNull(mydatatable(0).FirstName) Then

                    strfirstname = mydatatable(0).FirstName
                    Label1.Text = strfirstname
                End If      ................

(goes on for more columns)

However, the page throws an error when it gets to a column with a null value:

Line 2068: get { Line 2069: try { Line 2070: return ((string)(this[this.tableUserInfo.FirstNameColumn])); Line 2071: } Line 2072: catch (global::System.InvalidCastException e) {


Update a table from a dataset



I have a data flow task in which I have a dataset containing some rows and now I want to update the rows in a table, not insert them. Is there any way to do that in the task?



How to get Default value in table to work when NULL in DataSet

Is this possible? If the parameter value is NULL in DataSet, the default value is not assigned.

Multiple Dataset in one table


Hi All,

I have one table with three column say


where A is Metrics column ,B having sum (Metrics) of one day ,C having sum(metrics) of 2 days as below


Metrics                          1 day                                             2 day

A                      12 (Value of Column B)           67 (Value of Column C)



B and C will come from different dataset,kindly sugest how to do this,i have to retreive data on the basis of Metrics.



DataSet Table Names


Hello, this is probably a stupid question, but is there anyway to pass in a Table Name to a DataSet?

I'm executing a stored procedure that is returning several recordsets. I have no problems w/ changing the DataTable's name from my Code Behind, but I was wondering if there was anyway the stored procedure could actually pass back the name of each recordset/datatable?

I hope this made sense! :) 

Creating Table from DataSet


Hello all,

Real simple one here.  I'd like to create a table on my Page from a DataSet.  It looks like I have it working properly, but what I'd like to do is interpret the columns, as well as be selective with which column to display.

            Dim dc As DataColumn
            Dim dr As DataRow

            For Each dr In ds.Tables(0).Rows

                Dim trow As New TableRow

                For Each dc In ds.Tables(0).Columns

                    Dim tcell As New TableCell

                    tcell.Controls.Add(New LiteralControl(dr(dc.ColumnName).ToString))



I would like specific columns, by name or position doesnt matter.

So if a column is = named column, then addcell

and also, the data needs to be interpreted: If value of column = x then response.write("y")

In sum, I dont want all the columns, just specific ones, then I was to interpret whats in that cell, and write something.

For Each dc In ds.Tables(0).Columns

How to add cells to html table from dataset


I'm trying to code an html table dynamically, adding the data from a dataset - -

(by the way, the output is on a mobile device)

I keep getting an error:
Multiple controls with the same ID 'tcell0' were found. FindControl requires that controls have unique IDs.

Here's the code (including what I've tried - commented out):

  Dim i As Integer

  ' For Each dc In ds.Tables(0).Columns

  For i = 0 To ds.Tables(0).Columns.Count - 1

  Dim tcell As New HtmlTableCell

  tcell.ID = "tcell" & i.ToString

  tcell.InnerText = dr(i).ToString() & "-" & tcell.ID  

  'tcell.ID = "tcell" & i.ToString


  'i += 1



if I don't add the cell.id, all the text gets added to t

Create a XML file from Database table using Dataset



I've got a SQL database with a table named contact with different column such Name, Address, email ...

I would like to generate a XML file based on the table data:


     <name> John</name>

    <address> 100 main street </address>



After some research it looks like I can use a dataset from that table to create my xml.

Being a beginner I cannot find the right steps / syntax to do so.

Is there any tutorial showing how to work with dataset and XLM?

Thank you for your helps 


Dataset has one field, populate a table 2 columns wide n rows deep



A dataset returns a single field of child names, instead of presenting this as a single column table, I would like it to be multi column.

Dataset returns:


I would like to display it as:

Child1 Child2 
Child3 Child4


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