ado.net

Informing the user that a DataGridView is being populated

I am writing a program in VB.Net to manage text messages sent through an API. It allows you to view messages in a datagridview and filter by date, sent/unsent etc... To load the messages I'm executing an SQL statement and retrieving a DataTable which then gets set as the DataSource for my DataGridView control. The problem is that depen...

ADO.NET DataRelations and many-to-many relationship

I was really drawn in and fascinated by the DataRelation object for use in an ADO.NET DataSet to cache data from my database in an ASP.NET web application. Unfortunately, I realized quite late, that I really have three DataTables. Users with a PK of UserID Groups with a PK of GroupID UsersInGroups a linking table with UserID and Group...

what's wrong with this ADODB connection string to sql server 2005

I'm working on populating a combobox in visual studio 2005 using vb and I'm stuck on the connection string part. I should mention i'm connecting to a SQL Server 2005 instance. Here is what i have: Dim gDBA As ADODB.Connection Dim records As ADODB.Recordset gDBA = New ADODB.Connection gDBA.Open("Server=e-13;Database=subscribers;User...

Using SMO, still no go... ConnectionContext.ExecuteNonQuery(script) can't understand "GO"

Hello! SQL Server 2008 Using all the correct references I dare say: System.Data.SqlClient; Microsoft.SqlServer.Management.Smo; Microsoft.SqlServer.Management.Common; Microsoft.SqlServer.Management.Sdk.Sfc; All compiles with no errors. I have stripped code down to almost zero for easy debugging. Connecting to server alright and so o...

Ado Entity Framework Adding Data

Hi everyone, I'm having a little trouble with my Entity add functionality. Setup For simplicity, I have in DB with 4 tables, Customer, Address, Area, Location. Customer stores basic customer details ie. Id, Name, Username, Password, etc. Address stores street name, street number, etc. Area stores area name and area code. Location st...

Entity Framework v2 doesn't support sql 2000?

I installed the beta 2 of Visual Studio 2010 today. I went to test out the new entity framework stuff (to see if my "issues" from v1 were fixed.). I started adding a new connection string, but when i put in my information for sql 2000 it said "this server version is not supported. you must have Microsoft sql server 2005 or later.". Did...

visusal studio embedded crystal report keeps prompting database login?

I'm using visual studio 2005 to develop a form with a combobox passing a value into the parameter of an embedded crystal report. I'm trying to figure out why it keeps prompting me for a database login every single time you try to run the report with a different combobox selection. Here is my code: private Sub Form1_load... ...

How to manage SQL Connections with a utility class?

We have a SQL utility class that takes the name of a stored procedure an its input parameters, and returns the results in datatable. The reasoning behind this is so that we don't have to worry about forgetting to close connections and having connection leaks. Also so that we can reduce code by not having to recreate datadapters and dat...

How do i retrieve table values from an Oracle database using ADO.NET without having to specify each ref cursor output parameter?

Hello folks, i'm working in an app that was originally built to connect to SQL Server by using ADO.NET SqlClientProvider. Recently, i had to generalize the data provider code to work with either SQL Server or Oracle (by using DbClasses instead of SqlClasses and so on...). My problem is: Oracle SPs need to use ref cursors to retrieve ta...

Updating a dataset doesn't have to be as complex as this does it?

From API In a typical multiple-tier implementation, the steps for creating and refreshing a DataSet, and in turn, updating the original data are to: Build and fill each DataTable in a DataSet with data from a data source using a DataAdapter. Change the data in individual DataTable objects by adding, updating, or deleting DataRow objec...

Ado Entity Framework when should you use attach/detach

Hello, In ADO.net EF, when should you call the context.Attach() and the context.Detach() methods and how do these calls affect the data being returned or being inserted? ...

how to quickly check communication protocol used by SQL Server

Hello everyone, I am using VSTS 2008 + C# + ADO.Net + SQL Server 2008. When connecting from another remote machine, normally TCP/IP protocol is used by ADO.Net client to connect to SQL Server 2008. When connecting locally (ADO.Net client and SQL Server on the same machine), normally shared memory or named pipe is used. My question is, ...

SNIReadSync executing between 120-500 ms for a simple query. What do I look for?

Hi Stackoverflow, I am executing a simple query against SQL Server 2005: protected static void InitConnection(IDbCommand cmd) { cmd.CommandText = "set transaction isolation level read uncommitted "; cmd.ExecuteNonQuery(); } Whenever I profile with dotTrace 3.1, it claims that SNIReadSync method is taki...

Accessing application variables in DataAccesslayer (another project under same solution)

I have a solution with 3 projects.One of UI (contains web pages) and one for BL and one for DataAccess layer.Now i want to access one values stored in application variable in one class inside my DataAccess layer project.How can i access application variables there ? ...

Problem in the connection string of Microsof SQL Server 2005 !

Hi, I have MSSQLServer 2005 installed on my machine. I am creating a connection string like this: String sqlConnectionString= user id=admin; password=admin; server=MachineName\MSSQLSERVER; Trusted_Connection=no; database=MYDataBase; connection timeout=30 When I do: myConnection = new SqlConnection(sqlConnectionString); myConnection.O...

cannot open user default database. login failed error

Hi, I am getting this "cannot open user default database. login failed" error. What I did was using ORM to create DataContext, in the code first call TableExists function to check if the version_tbl existed, if not, then call scripts to exec sql commands to create version_tbl. Then create a new dataContext, but problem is after the ca...

SqlBulkCopy refuses to convert String.Empty into INT NULL

Hi, Recently I've been tasked with creating an automated ETL process that pumps the data into tables based on the flat file name by reading a master mapping file. I've decided to go with SqlBulkCopy and everything seemed to be fine. IDataReader interface was implemented to read flat-files, SQL Server's meta-data provided with number of ...

Entity Framework - partial commit

Hello, I've been wondering for some time if there is any way in Entity Framework to save some changes to the database and others not. Imagine a situation in which I have let's say 4 entity classes - Customer, Task, SalesSchema and Address. Each of those is a customers one-to-many relationship. Now I create a window with 3 tabs (using Tab...

Looking for a simple ASP.Net web site sample

Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 + ADO.Net + ASP.Net + SQL Server 2008 Enterprise + IIS 7.0. I want to save my time to write an simple ASP.Net web site. And want to see if I can find an available one here. :-) What I need is very simple, (1) basic UI (2) could edit/update/delete data from database (any kinds of data...

Mixing System.Transactions with SqlTransactions

I've been brushing up on my knowledge this evening, trying to overcome 4 years of bad programming practices because of the company I was working for. One of the things I've recently stumbled on was System.Transactions. After reading about them for the last few hours, I think I have an adequate understanding of how they work and why you w...