Questions tagged [sqldataadapter]

Represents a set of data commands and a database connection that are used to fill the DataSet and update a SQL Server database.

The SqlDataAdapter, serves as a bridge between a DataSet and SQL Server for retrieving and saving data. The SqlDataAdapter provides this bridge by mapping Fill, which changes the data in the DataSet to match the data in the data source, and Update, which changes the data in the data source to match the data in the DataSet, using the appropriate Transact-SQL statements against the data source.

438 questions
2
votes
2 answers

SqlDataAdapter Get Identity after insert

I create a SqlDataAdapter after a fill it to Dataset. My question is that after insert I want to get the IDENTITY value for primary column. For example a give buttonedit1 editvalue is Id (this is my primary column) after insert I want to get…
IsimYok
  • 21
  • 1
  • 1
  • 2
2
votes
1 answer

With ADO, using SqlDataAdapter.FillSchema clears @ReturnValues and other stored procedure parameters marked for output

[Edit - an explanation of the answer is at the foot of the question because the subtlety is not totally obvious from the accepted answer.] Original question: I am looking for a quick 'yes this approach should be possible' answer before I commit…
Vanquished Wombat
  • 9,075
  • 5
  • 28
  • 67
2
votes
0 answers

Concurrency violation appears when I add rows and update rows in certain situation

My setup is simple, a DataGridView binded to a BindingSource The BindingSource is binded to a DataTable The DataTable is populated by a simple adapter.Fill(table); Now this works well, but since today I get this error in a certain…
GuidoG
  • 11,359
  • 6
  • 44
  • 79
2
votes
1 answer

How to get values from BindingSource in C#

I am working with WinForm in this i have 3 RadioButton one ComboBox and have three BindingSource I want that when I check any of the RadioButtons, the values from the particular DataSources get bound to the ComboBox's ValueMember and…
Danish
  • 343
  • 1
  • 8
  • 21
2
votes
1 answer

Wrapper that properly disposes and closes database objects

I have a simple helper function that looks up data in a SQL Server database and returns a dataset. This function is used in lot of different places in my web application. For the most part, it works great. However when there are a lot of concurrent…
SkyeBoniwell
  • 6,345
  • 12
  • 81
  • 185
2
votes
1 answer

SqlDataAdapter.Fill() incorrect syntax near "=" C#

I am getting this error Incorrect syntax near "=" I am getting this error on the line sda.Fill(dt); I can't figure out what mistake I have made. I went through many articles but none of them can help me with my problem. SqlConnection con = new…
Ashwini Nemade
  • 153
  • 1
  • 13
2
votes
2 answers

Why won't this DataAdapter insert rows into the database?

So I have a situation where I am using a SqlDataAdapter to insert rows into a table in a SQL Server 2014 database. The source of the data is an Excel spreadsheet. The insert works fine when the DataTable object is populated using a few For loops and…
Jacob H
  • 2,455
  • 1
  • 12
  • 29
2
votes
4 answers

Trying to pass SqlCommand in SqlDataAdapter as parameters

I've successfully built up my method to execute a select command. It is working fine. Then I change my code for SqlDataAdapter DA = new SqlDataAdapter(); I tried to pass SqlCommand as CommandType.Text in the parameters but I can not do it…
user4221591
  • 2,084
  • 7
  • 34
  • 68
2
votes
0 answers

NULL value row not showing in GridView

I have an Event Table with ContactID as foreign key. When I delete a contact from Contact Table, I set ContactID in Event Table to NULL. In Event GridView I am displaying Event Information along with ContactName and Number from Contact…
el323
  • 2,760
  • 10
  • 45
  • 80
2
votes
1 answer

multithreading sqldatareader time expired

Here is scenario: I want to insert data to table from server A to server B. The data is very huge, so I will use SqlBulkCopy to do the job. Here is my idea: producer: get all page number consumer: get page number, paging data from server A and…
2
votes
1 answer

SQLDataAdapter not returning last row of data

I'm writing a program to pull data from an SQL database and input it into Excel. I have it all working, except that I noticed the rows I have returned in Excel do not match what I see in SQL. The last row is consistently trimmed when filling the…
Alex
  • 33
  • 6
2
votes
1 answer

Getting error creating Excel through C# : Transition into COM context 0x56b098

I am trying to create an Excel file through C# code and scenario is that I have a stored procedure which returns 15000 records and I am reading the data through a SqlDataAdapter and data is then populated in the DataTable and then I am filling the…
Sohaib Akhtar
  • 145
  • 1
  • 3
  • 11
2
votes
2 answers

Get Count of Affected rows of SQL table

I would like to know how can I get the count of affected rows when using the SqlDataAdapter class. Does this line return the no. of affected rows? adapter.UpdateCommand = command;
Shiza Khan
  • 51
  • 5
2
votes
0 answers

SqlDataAdapter.Fill takes time more than CommandTimeout

When I execute this query, though I set the ConnectionTimeOut to 1 second, SqlDataAdapter.Fill takes more time than 65 second. and timeout not work. var cmd = new SqlCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select * FROM…
Fred
  • 3,365
  • 4
  • 36
  • 57
2
votes
3 answers

Getting error message in SqlDataAdapter.Update()

I have a DB table (which is empty in this example) create table words ( id int not null, word nvarchar(50) not null ) and a DataGridView which I'm filling like that: private SqlConnection _conn; private SqlDataAdapter…
cesarito
  • 136
  • 2
  • 5