ado.net

How do I run my .sql script file through ADO.NET?

I want to run my .sql script file using my ASP.NET website through ADO.NET. How it could be it is not working? When I try 'dbScript is a string and contains contents of the .sql file' Dim cmd As New SqlCommand(dbScript, con) Try con.Open() cmd.ExecuteNonQuery() Catch ex As Exception Finally con.Close() cmd.Dispose() End...

C#: How to import SQL-script into database programmatically?

Do I have to parse the SQL-script manually and execute each statement separately or are there better ways? Iam looking for a programmatically solution, I know there are tools which are already able to do this. It would be good if the solution would work for all database systems, not just sqlite. ...

Fastest way to load an XML crypto stream into a Datatable

I currently have an XML file that is encrypted that I decrypt and put into a crypto stream. I then pass that to a method that uses the DataTable.readxml. The readxml() method takes 5-6 seconds but I'm hoping to get it down to 3-4 seconds. (or less) There are ~90k entries. I then use the DataTable for parsing data which eventually mak...

Does the using the entity framework put a lot of pressure on memory, like the DataSet does?

I'm new to the entity framework. Some screen casts I've been watching, show results sets being held in memory with their changes. This seems like it could use a lot of memory. Does this mean that EF isn't suitable for ASP.NET development? Does the entity framework have a memory efficient pattern similar to the SqlDataReader? ...

How to write a .Net application that works with both SqlServer and Oracle (now that System.Data.OracleClient is deprecated)

see also System.Data.OracleClient namespace discontinued? (Firstly don’t panic yet, System.Data.OracleClient is not being removed by Microsoft yet, however it is not in the client version of .net 4) This use to be possible by using System.Data.OracleClient, however Microsoft has decided to deprecate OracleClient. (OracleClient is the ...

ODP.NET and ClickOnce possible?

We have a sqlserver (WinForms) application that is deployed with ClickOnce that talks directly to the database. If we are forced to port it to oracle, can ODP.NET be used with ClickOnce. (The users may not have admin rights on their PCs) Background This data import application is used by a handful of users at each customer’s site it ...

Which is fastest to transmit: XML or DataTables?

Hello, I would like to know which is faster. Let me give you the scenario. I'm on a LAN, have a report to build using data from a SQL Server database (if we need the version let's say 2005) and have these ways of getting the report done: (1). Have a web service at the server, where the data is taken from the server and serialized into ...

c# and ms access database (Updating)

Good Day created Windows form application in c#, created a data source in c# from the my MS Access database 'inspro' on the form I coded for the save button: try { this.Validate(); this.entitiesBindingSource.EndEdit(); this.entitiesTableAdapter.Update(this.iNSPRODataSet.Entities); ...

Connect remote SQLServer Database programmatically using VPN

Hey Ya'll, I can connect to VPN and I can access Sql Server using RDP. Now, I want to access the Sql Server programmatically. I connected to the VPN and then have the following connection string set up: **constr = 'Data Source=servername;Initial Catalog=dbname;User ID=username;Password=passwd;' error: login failed for username PS: ...

ADO.NET Whitespace padding problem

Hi all, I've switched from LINQ to SQL to ADO.NET (with MSSQL) because of a problem I described earlier, but I also ran into a weird problem using ADO.NET. I import data from an excel worksheet using excel interop and I place its contents to the database. I trim everything that gets inserted, so this is not (supposed to be) the source ...

How are OLE DB connection strings mapped to DLLs?

How does the OleDbConnection constructor know what provider DLL (I assume it's a DLL) to call for a given provider name in the connection string? For example, in the following code... string cnStr = "Provider=Sybase.ASEOLEDBProvider.2;Server Name=etc..."; OleDbConnection cn = new OleDbConnection(cnStr); How does OleDbConnection know w...

Reading SQL column name from querystring and building secure query from it

I am building in C#/.NET2.0 a page that updates different columns dynamically in SQL call for example: myajaxpage.aspx?id=1111&fieldname=title What is the correct way to build SQL query for reading column name from querystring? Is this good approach in a first place? I tried: cmd.CommandText = "UPDATE MyTable SET +"Request.QueryStri...

Sending several ExecuteNonQuery() to same database, which transaction type and error checking to use? (.NET)

I have an asp.net web site which will send several ExecuteNonQuery() statements (stored proc) to the same database (Sql server 2005). MSDTC service is turned off on both web and database servers. These statements need to run all successfully, all or none. So I need to wrap them in transaction. Is the best way to use SQLTranscation? Atta...

And/or keyword when search with ASP.NET

I'm now writing a searching application on C#/ASP.NET. User inputs a keyword into a textbox, and then my app finds appropriate results from SQL Server through ADO.NET. I want to implement ability to search using AND/OR keyword in my application. For example: Now my users can input a keyword such as "Cisco". Now they want to search ...

"fatal error encountered during command execution" when trying to add a view from MySQL DB

I'm trying to add some tables and views from a MySQL database to a project in VS2005. After a lot of looking around I ended using the ADO.NET connector, which works pretty fine, except when trying to add a View with the Data source configuration wizard, where I get the "fatal error encountered during command execution" error message, and...

Why is AllowDBNull true for Sql non-nullable columns?

When I read a record from SQL Server, a non-nullable column comes through as a DataColumn with AllowDBNull set to true. What is happening here? ...

Possible ways for testing automation of ASP.NET2.0/ADO.NET project

What approaches could you please suggest me for testing (using NUnit?) a complex ASP.NET 2.0 solution - large web-site with a number of depending assemblies (App_Code is inside on of them). I want to test web pages functionality - will web controls like GridView, FormView, DetailsView, etc insert and load the data from SQL Server 2008 p...

Getting a new connection from the connection pool times out in ASP.Net application. I need suggestions for mitigation

We are getting the following error on a certain database occasionally under moderate load. "System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached." I have combed through ...

How to cast a Dataset into Strongly Type Object ?

Hello guys, I get some informations in a Dataset, and i would like to cast it in a strongly type object. For example my dataset have : TableName : tab_data Rows : 1 Columns : Name, FirstName, Address So i created a class like : public class Customer { public String Name; public String FirstName; public String Address; } Is there...

Serialize a .Net SqlTransaction?

We have an interesting setup where we have SqlTransactions persisted to Application memory on a web application. We're looking into moving our web application into an NLB scenario, so we need a way for those Transactions to not be tied to a single machine's memory. Is there any way we can accomplish this..I've tried serializing a SqlTran...