ado.net

Updating a Data Source with a Dataset

Hi, I need advice. I have asp.net web service and winforms client app. Client call this web method and get dataset. 1. [WebMethod] 2. public DataSet GetSecureDataSet(string id) 3. { 4. 5. 6. SqlConnection conn = null; 7. SqlDataAdapter da = null; 8. DataSet ds; 9. try ...

how i insert values from list of Data Grid View?

it show me this error Incorrect syntax near the keyword 'Select' to make to clear Employee ID in this case is FK in the table (Attendance detail) and the other thing is i am using Data Grid View from another table(Employee information) to Show the list of the staff in my form. then i want to transfer each selected cell value from Data...

getschema("foreignkeys") against SqlClient doesn't yield enough information

I need two tables and two sets of fields, not the name of the foreign key and one of the table names. Does anyone know how to query SQL Server for complete foreign key information? Thanks! ...

Changing populated DataTable column data types

Hi, I have a System.Data.DataTable which is populated by reading a CSV file which sets the datatype of each column to string. I want to append the contents of the DataTable to an existing database table - currently this is done using SqlBulkCopy with the DataTable as the source. However, the column data types of the DataTable need to ...

Previous Data in Table .NET 1.1

How can I get the previous version of data of a Row in a DataTable? The data has only changed but hasn't been saved yet. The .NET version I'm working on is 1.1 ...

Benefits of using SqlCommand.ExecuteNonQuery instead of …

a) SqlCommand.ExecuteNonQuery is used for update, insert and delete operations. Besides the fact that by using ExecuteNonQuery instead of ExecuteReader we automatically know there won’t be any query results returned, are there some other benefits/reasons why ExecuteNonQuery should be used? b) Similarly, if we want a database operation...

Send shrink Command to Microsoft SQL Database file via Ado.net connection

How is it possible to execute a direct SQL command to an ADO.NET connected database? I want to send a DBCC SHRINKDATABASE to the SQL server, to compress the current datafile after a big deletion process. The function ObjectContext::CreateQuery returns a parser error after the DBCC command. Is there any other way to shrink the database f...

SqlCommand - preventing stored proc call in other databases

When using SqlCommand to call a stored proc via RPC, it looks like it is possible to call a stored proc in a database other than the current database. e.g. : string storedProcName = "SomeOtherDatabase.dbo.SomeStoredProc"; SqlCommand cmd = new SqlCommand(storedProcName); cmd.CommandType = CommandType.StoredProcedure; I'd like to m...

Is it possible to easily convert SqlCommand to T-SQL string ?

I have a populated SqlCommand object containing the command text and parameters of various database types along with their values. What I need is a T-SQL script that I could simply execute that would have the same effect as calling the ExecuteNonQuery method on the command object. Is there an easy way to do such "script dump" or do I ha...

Single Query returning me 4 tables, How to get all of them back into dataset ?

How to fill multiple tables in a dataset. I m using a query that returns me four tables. At the frontend I am trying to fill all the four resultant table into dataset. Here is my Query. Query is not complete. But it is just a refrence for my Ques Select * from tblxyz compute sum(col1) suppose this query returns more than one table...

Put a filter on DataView by time

How to filter DataView/DataTable by time? I have a table with datetime column inside and I need to filter by the time that is inside that datetime value. In native SQL it's not so hard but in ADO.NET Expressions it makes a dificulity for me. ...

Exception when calling stored procedure: ORA-01460 - unimplemented or unreasonable conversion requested

I'm trying to call a stored procedure using ADO .NET and I'm getting the following error: ORA-01460 - unimplemented or unreasonable conversion requested The stored procedure I'm trying to call has the following parameters: param1 IN VARCHAR2, param2 IN NUMBER, param3 IN VARCHAR2, param4 OUT NUMBER, param5 OUT NUMBER, param6 OUT ...

WPF: How to connect to a sql ce 3.5 database with ADO.NET?

Hi, I'm trying to write an application that has two DataGrids - the first one displays customers and the second one selected customer's records. I have generated the ADO.NET Entity Model and the connection property are set in App.config file. Now I want to populate the datagrids with the data from sql ce 3.5 database which does not suppo...

Question about how to use strong typed dataset in N-tier application for .NET

I need some expert advice on strong typed data sets in ADO.NET that are generated by the Visual Studio. Here are the details. Thank you in advance. I want to write a N-tier application where Presentation layer is in C#/windows forms, Business Layer is a Web service and Data Access Layer is SQL db. So, I used Visual Studio 2005 for this...

RowFilter including [ character in search string

I fill a DataSet and allow the user to enter a search string. Instead of hitting the database again, I set the RowFilter to display the selected data. When the user enters a square bracket ( "[" ) I get an error "Error in Like Operator". I know there is a list of characters that need prefixed with "\" when they are used in a field nam...

How do I use C# and ADO.NET to query an Oracle table with a spatial column of type SDO_GEOMETRY?

My development machine is running Windows 7 Enterprise, 64-bit version. I am using Visual Studio 2010 Release Candidate. I am connecting to an Oracle 11g Enterprise server version 11.1.0.7.0. I had a difficult time locating Oracle client software that is made for 64-bit Windows systems and eventually landed here to download what I assume...

How to use unlinked result of linq?

Hello, for example I'm trying to get the data from database like: using (ExplorerDataContext context = new ExplorerDataContext()) { ObjectQuery<Store> stores = context.Store; ObjectQuery<ProductPrice> productPrice = context.ProductPrice; ObjectQuery<Product> products = context.Product; ...

How does MS Data Access Application Block(daab) compare to ado.net datareader performance wise

I am going to use the DAAB to prevent a lot of manual labor in my database intensive application. But before I get started I would like to know if there would be any noticeable perfoemce differences between using the native ado.net datareader and the DAAB. ...

ADO.NET connection string and password with "=" in it

How do I build a connection string which includes a passsword having a "=" in it? (I'm connecting to MySql 5.1) For example, let's say the password is "Ge5f8z=6", what would the connection string look like? I tried: Server=DBSERV;Database=mydb;UID=myuser;PWD="Ge5f8z=6"; and Server=DBSERV;Database=mydb;UID=myuser;PWD=Ge5f8z=6;" Bo...

How to issue SQL Server lock hints in WCF Entity Framework?

I'm just learning the WCF entity framework (and .net in general), and I'm running into a problem specifying lock hints in an embedded SQL query. I'm trying to specify a query that has lock hints in it (e.g., "SELECT * FROM xyz WITH(XLOCK, ROWLOCK)") and I keep getting errors from the runtime that the query syntax is not valid. The quer...