Do I need to close a SqlDataReader before I call Dispose on it?
According to this, Dispose() on a SqlConnection calls Close(), so you don't need to call both, just Dispose(). Is it the same for a SqlDataReader? ...
According to this, Dispose() on a SqlConnection calls Close(), so you don't need to call both, just Dispose(). Is it the same for a SqlDataReader? ...
I've just started working with Visual Studio and C#, and am trying to solve a small problem I have. I come from a Microsoft Access background, and have quite a bit of experience with database queries and forms. However, I am currently trying to re-implement an access database with C#, ADO.net, and Windows Forms. Visual Studio makes it...
Hi, I'm using the microsoft EdmGen2 to generate my edmx file from my database. The tool works great, but there is one things missing - it doesn't support function. Is there a way to map all the stored procedures to be functions? Also, if i'm editing it manually, the next time im running this tool, i'm losing all those changes. my ques...
I am trying to create a search page, this allows the admin to search through the entries in the database by certain criteria, such as province (like state but diff country) Here is the code I have so far. The problem is that I am not getting any errors. But I am also not getting any results. The page just posts back and returns to the b...
I have used code like this: http://msdn.microsoft.com/en-us/library/dw70f090.aspx to access database before when working in ASP.NET (2-3 years ago). I didn't realize I was working with ADO.NET. I am just a bit confused...is there another way data in a database can be accessed? How else would you do it? ...
What is the detailed syntax for the 'CREATE DATABASE' statement for VistaDB? The documentation only describes various procedures,functions,operators etc, but nothing on the 'CREATE DATABASE' statement. The 'create database' 'how-to' specifies hard coded values for the page size and other parameters, but can I use an ADO.NET connection ...
What is the best way to create an Empty DataTable object with the schema of a sql server table? ...
Hi, I'm implementing "type-independent" method for filling DataRow with values. Intended functionality is quite straight forward - caller passes the collection of string representations of column values and DataRow that needs to be filled: private void FillDataRow(List<ColumnTypeStringRep> rowInput, DataRow row) ColumnTypeStringRep s...
I am building an application and I want to batch multiple queries into a single round-trip to the database. For example, lets say a single page needs to display a list of users, a list of groups and a list of permissions. So I have stored procs (or just simple sql commands like "select * from Users"), and I want to execute three of the...
I can run this command in SqlManager to detach the db ALTER DATABASE mydb SET OFFLINE WITH ROLLBACK IMMEDIATE GO dbo.sp_detach_db @dbname = N'mydb',@keepfulltextindexfile = N'false' When I use the same connection running the same commadn via ado.net fails with error: The database 'mydb' can not be opened because it is offline (E...
I dont understand why I cannot do the below - This should work?? foreach (DataRow dataRow in dataTable.Rows) { if (true) { dataRow.Delete(); } } ...
I am reading the database schema for VistaDB 4.0 database using the standard ADO.NET 'DbConnection.GetSchema' API. I haven't found a way to obtain the 'Identity' setting for a column? The 'Columns' schema collection doesn't seem to have a column for this and I am not aware of any other collection that I should look into. If it is not po...
My application has a populated datatable and binds it to a ddatagridview by setting the datasource property. At run time I want to filter this table. When the user clicks a button I run the following code: dataManager.VDMSTables.DataTable.DefaultView.RowFilter = column + " LIKE '%" + criteria + "%'"; All the classes are populated cor...
Which approach is recommended: void Add(int? value) { command.Parameters.Add("@foo").Value = value; } or void Add(int? value) { command.Parameters.Add("@foo").Value = (object)value ?? DBNull.Value; } ...
Is it possible to export a sql server database (2008) to a new access database using the Entity framework (or anything else for that matter in code)? I have developed a desktop facing application that connects to a sql sever on a server and my client wants to be able to take snapshots of the database in access to send to people who do...
This is my datatable public static DataTable GetTableForApproval() { using (var connection = Utils.Database.GetConnection()) using (var command = new SqlCommand("SELECT [UserID], [Username], " + "[Email], [Role], [Date] FROM [Users] WHERE [Role] = @role", connection)) { command.Parameters.AddWi...
Hi all. The purpose is to handle the user's data (you can call them project, document, file, or whatever) in a brand new SQL Server 2008 Express database. The data are expected to occupy much less space than the 4GB available with the express edition (which is also free to distribute). E.g., each time the user selects File->New command...
I am having tough time since 2 days, and not able to figure out what should i do with my implementation. I am not sure if this could be really workable. Please help me on this. Below is my scenario: I have a .Net Dll which has a method that returns a SqlConnection object after opening it. Below is the function (similar to which i am u...
I try to do the following: Detach the database Copy files to a temporary folder Attach the database again This works the first time, but when I try to run this method a second time from the same process I get an error. I can always access the databse that was attached again from other clients, but not from within my application. The...
hi Are there any other fast way to fill a Data table in ADO.Net without using Data adaptor.Fill method? ...