ado.net

How to implement AsyncCallback when importing rows?

Hello, I never used AsyncCallback. Need your help. When In Windows Form app I importing rows application form freezes. To prevent it, i think I can use AsyncCallback. foreach (DataRow dr in srcdt.Rows) { desdt.ImportRow(dr); } and while importing rows, to show in lebel.Text imported row count. Some help please. ...

Is SQL Injection possible when parameter's type isn't set?

Does passing SQL Parameters to a stored procedure alone ensure that SQL injection won't happen or the type checks also need to be performed? As an example - ADO.NET Code: Database DBObject = DataAccess.DAL.GetDataBase(); DbCommand command = DBObject.GetStoredProcCommand("usp_UpdateDatabase"); List<DbParameter> parameters...

ADO.NET Entity Framework and WCF Service

I have a simple ADO.NET Entity Framework 4.0 model (edmx) which defines database tables with foreign key relationships. How can I send these entities down to a Windows Phone 7 client? I have created a WCF Service (using WShttpbinding),with the method... public List<LocationCity> ListCities() { var dc = ObjectFactory.GetInstance...

C#/Oracle10g = null vs DBNull.Value vs String.Empty

I'm making my first forays into Accessing Oracle from C#. I've discovered that that Oracle doesn't like VarChar parameters to have value of null (C#). I would have hoped that there would be some implicit conversion, but I appreciate the difference. So I need to trap these null values and supply DBNull.Value instead, surely? The most obv...

Table is not getting updated , when used executeNonquery

Hi, I am trying to change the user password. I am not able to update the password :(. The message i am getting is password changed where as its not getting changed. . My code is as follow.. Please if anyone can suggest where i am going wrong . I am just a beginner ... protected void Button1_Click(object sender, EventArgs e) { Datab...

Creating UI and database dynamically, what is the best approach?

I have a requirement in which in order to make an application extensible and reusable, I have to create a provision through which a user would be able to provide a business object structure (the fields, their types, etc.) through an XML file and using that structure the UI (i.e. the controls and the complete page), the data updation meth...

jdbctemplate concept and c#

Is there something similar with spring jdbctemplate for c# ? I am not seeking for jdbctemplate for c# but something that works very similar like jdbctemplate. I am familiar with ado net and linq to entities, but I like the concept of jdbctemplate. ...

EntityFramework "System.Data.EntityClient.EntityConnection.get_ServerVersion"

I am a newbie to ADO.net entity framework. I added 3 tables from the database and tried to query, base.CreateQuery gives exception "an item with the same key has already been added". Validate doesn't show any message either. FISSEntities SecurityMastercn = new FISSEntities(connectionString); var vwCadis = from cusip in SecurityMa...

Azure differences between local fabric and cloud handling of datatypes

We recently spent the afternoon debugging our Azure application after trying to move the storage from the local store to the cloud storage -- the first step in moving the entire thing to the cloud. We came across a problem in where the local fabric storage was letting us store improperly initialized DateTime objects (initialized to Date...

Support for dealing with data provider-specific differences in ADO.NET data provider-independent code?

I have an ADO.NET data access layer that has been written to work with multiple data providers, and am finding that I can't make some operations completely data provider independent. As part of my application's installation functionality, it tells the DAL to create a database with a table and some data. The DAL uses the Sql command CREA...

Displaying Data in GridView using Dataset

Hello, I am trying to display a dataset to my ASP.NET application. It seems that when I click the button event, the data is not displaying in the grid. I have a basic page with the following: <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel runat="server" id="Upda...

ADO.NET + Sql Server Varchar encoding problem

Put simply, I have a set of special characters in a Sql Server database varchar column, and I want to fetch it from a C# application. Now the difficulty is: using Query Analyzer, I get the desired value of: "·°ï££". However, through the client application, I end up with: "À░´úú". It's a varchar column in a database with collation SQL_...

when i run the query in query analyzer it returns one row but when i use the same query in vb.net no rows are returned

here is the code Function getData(ByVal id As String) Dim reader As SqlClient.SqlDataReader Dim statement As String Dim count As Integer Dim temp As Integer statement = "SELECT * FROM General WHERE accountid='" + id + "'" Conn.Open() Comm = New SqlClient.SqlCommand(statement, Conn) reader = Comm.Execute...

Insert data into SQl Server Database using ADO.Net Dataset

Hello, I have a small database with a table with 2 columns (ID and Name) I have an ASP.Net form that i want to input an ID and a Name and upon clicking the button, it will insert rows into the database I want to do this using a dataset. Meaning, I want to add the rows first into a ado.net dataset. Once I have the dataset with its tabl...

How to use SqlCommand to CREATE DATABASE with parameterized db name?

To put it short. I've got two simple helpers: private SqlCommand CreateCommand(string text) { SqlCommand cmd = new SqlCommand(); cmd.Connection = connection; cmd.CommandType = CommandType.Text; cmd.CommandText = text; return cmd; } void SetParameter(SqlCommand cmd, string p, strin...

Can someone explain Query Reshaping in Linq with the following example?

I am reading this asp.net article on building your first asp.net mvc 2 website and I came across a Linq query that uses the Include method in the query. I have used some linq, but I have never used the Include method and would like a better explanation. Does it translate to an join in linq? What is the benefit? Here is the query from...

Is there an way using ADO.NET to determine if a table exists in a database that works with any data provider?

Is there an way using ADO.NET to determine if a table exists in a database that works with any data provider? I'm currently doing something like this: bool DoesTableExist(string tableName) { DbCommand command = this.dbConnection.CreateCommand(); command.CommandText = "SELECT 1 FROM " + tableName; try { using (Db...

How to convert DataSet Value to DataReader?

How to convert DataSet Value to DataReader? ...

pushing a datatable from memory into SQL server using ADO.NET

I have a datatable in memory that I got from a non SQL source. What is the most elegant way, using ADO.NET to push it "as is into a new SQL (2005) server table? ...

Command.Prepare() Causing Memory Leakage?

I've sort of inherited some code on this scientific modelling project, and my colleagues and I are getting stumped by this problem. The guy who wrote this is now gone, so we can't ask him (go figure). Inside the data access layer, there is this insert() method. This does what it sounds like -- it inserts records into a database. It is ...