Tag: ado.net

Synchronization between SQL Server CE and SQL Server

How to synchronize data with SQL Server Standard Edition and SQL Server Compact Edition? I hope you will give positive answer regarding this question.

IDataReader for Generic Access

I’m trying to make a “Helper” class where you simply pass the driver and the parameters and the class does the connection and connection string assembly for you. I’ve been using the interfaces from System.Data like IDataReader, IDbConnection. Now after testing it with MySQL the code is working perfectly but as soon as I point […]

SQL using a lot of CPU

I have a database sync job where I loop over 1000s of rows in XML and update DB tables with any changes found in the XML using EF4.1 My code is : using (context = new MyDbContext()) { foreach (var row in document.Elements(“row”)) { //DO UPDATING IN HERE. //Part of which I call var results […]

ADO.NET EF + CF: How to use the existing CF context and bind SQL external objects (views, stored procedures, etc.)?

I have a database, 90% created with EF 4.1 + Code First approach on a SQL Server 2012; the rest is generated by some SQL code (FUNCTIONS, COMPUTED COLUMNS, VIEWS, INDEXES, ETC.). Now, I needed to use ObjectContext and at the same time optimize performance, so I created some SQL Views directly in the db, […]

Query on filters selected by the user

I am making a job portal where users can search jobs by keywords, job category, location salary range, company name…..and I want that if a user select only one option and start searching then he will get all results that belong to that particular option….and if a user select multiple options then result should be […]

is it compulsory to use .\SQLEXPRESS as value for data source in case of AttachDBfilename keyword?

data source=.\SQLEXPRESS;Initial File Name=|DataDirectory|ASPNET.mdf;Integrated Security=SSPI;User Instance=true i am using above connection string. It is working fine. But when change data source “.\SQLEXPRESS” to “localhos” it raise error “Invalid value for key ‘attachdbfilename’”. And my second question, what is the use of keyword “User Instace”.

Distinct Pagination with ROW_NUMBER() and Total Count in ASP.Net

In Asp.net, I am trying to achieve pagination using following code: String query=”SELECT * “+ “FROM (SELECT Distinct emp_name, emp_address, “+ ” ROW_NUMBER() OVER(ORDER BY emp_id) AS rownum”+ ” FROM Employee”+ ” )as Person “+ “WHERE rownum>”+ start +” and rownum <=”+ end +”; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); […]

using ADO.NET to select from multiple VFP tables

I need to select from 2 VFP free tables on some different network locations. I’ve managed to get both tables into a dataset as two DataTables and add a Relation for them. Now I need to join them and the result to insert into a SQL server database. Any ideas?

Must declare scalar variable error

I am trying to display sql select results from code-behind and however this error occurred: Must declare the scalar variable “@poNum”. Line 75: sdsUsers.SelectParameters.Add(“@poNum”, poNum.Text.Trim()); Line 76: Line 77: DataView dvMember = (DataView)sdsUsers.Select(DataSourceSelectArguments.Empty); //here the error Line 78: DataTable tblMember = dvMember.Table; Code: string connectionString2 = ConfigurationManager.ConnectionStrings[“WholesaleConnectionString”].ConnectionString; string selectSql = “SELECT invoiceNum, poNum FROM SendInvoice […]

Adding Multiple values to SQL Server table

First off I’d like to apologize if this is more of a question than an example but I’m really lost here. I have a Windows Form that loads info from a text file. In each text file there is all the cities and counties in a given state, each section is separated by the .Split. […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.