.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Closing down a mdb database properly for .net application

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :Sql Server
Hi I designed a simple database with 2 tables using MS SQL Express 2008 which I tried to open using MS C# Express 2008 but when I try to set up the Database Connection using the Database Connection Wizard I get error := The file cannot be opened because it is being used by another process. Please close all applications that might access this file and try again. I even Disconnected the Instance in SQLExpress Instance before closing down MS SQL Express 2008. If a reboot the PC then I can use the Database Connection Wizard from c# (but I don't want to have to reboot my PC as its annoying). Does anyone have the simple answer please. Thank you Matthew

View Complete Post

More Related Resource Links

Upsize Your Database: Convert Your Microsoft Access Application to Take Advantage of SQL Server 7.0


What if you need to convert an existing Microsoft Access 97 database application into a true client-server application that is based on a SQL Server back end? If you know a little about Visual Basic and SQL Server, it's easy to make your app take advantage of the power and scalability provided by SQL Server 7.0. Using some concrete code examples, this article takes you step by step through converting the native Jet queries in your Access application into stored procedures and pass-through queries that SQL Server can use. You'll also learn how to pass on parameters when your client-server app calls these SQL Server stored procedures and queries.

Michael McManus

MSDN Magazine June 2000

An example of packaging web application containing database upgrade SQL file

A few months ago, we have a blog talking about extending the web publishing pipeline to package database project deployed SQL file.  In this blog, I'll show step by step example of packaging web application with SQL Server database upgrade SQL file using Visual Studio 2010.  This way, we can generate a web package with incremental SQL script to certain database version.  The scenario may help distributions of a web upgrade package which needs to be installed on many different locations, each with their own SQL server database.   1. Create a Web Application Project 2. Add a new "SQL Server 2008 Database Project" to the solution 3. Prepare a development database, such as my test1 database as the following: 4. Right click our...(read more)

Creating an database search application in VS C#

Hello everyone, I wish to create a C# application that will have a form and a text box where I can enter a text, and then ask the application to search if this text exists in a database. If it exists, I want all the information associated with this text to be displayed in a datagrid view or list box. I am able to create a database in SQL Server and I can connect to my database from VS 2005 C#. If this is possible, how do I go about it? Many thanks in advance.

Problem with Movie Database Application

Hi Im following MVC tutorials on ASP.net website..I have a problem at Movies database application found in http://www.asp.net/mvc/tutorials/create-a-movie-database-application-in-15-minutes-with-asp-net-mvc-cs  Listing 3 - Views\Home\Index.aspx----------------------------------------------------------------------------------------------I dont understand where "Model" refer to in this code <% foreach (var item in Model) { %>  Also im confusing with accessing the database fields using var item Please explaine me what is happening in this code.<% foreach (var item in Model) { %> <tr> <td> <%= Html.ActionLink("Edit", "Edit", new { id=item.Id }) %> | <%= Html.ActionLink("Details", "Details", new { id=item.Id })%> Movie Database Application

The application failed to initialize properly (0xc0000006)

Hi, I have been trying to solve the above message when executing an application build with Microsoft Visual C# 2008 and Net Framework 3.5. I execute the application remotely on a cmd archive using \\server\share\app.exe The only acceptable solution I have found is http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/938b9bed-f317-4cca-9ec2-b6e8105f629b/ but it does not work. I executed the following command on the remote folder C:\Windows\Microsoft.NET\Framework\v2.XXXX\ caspol.exe -m -ag LocalIntranet_Zone -url file:\\server\Share\* FullTrust and it says ok, but it does not work neither. One thing to notice is that if running \\server\path\app.exe and change to \\server\path2\app.exe then it works!! Any advise? Many Thanks. Regards, Salva    

Looking for Clarification - Using a SQL Database MDF in an ASP.Net Application

I am looking to understand how to use Database files with ASP.Net web application projects. Very similar questions were posted, but I couldn't find quite the clarification I am looking for, so here's another post. I've been programming with ASP.Net for a while, but have always been in an environment where I had a full SQL server setup, and the databases were not file format. For the purposes of this project I am trying to keep it in .MDF format so that I can pass it on easily to my customer and let them do what they wish with it. The project is in Visual Studio 2010, a simple ASP.Net 4.0 MVC2 application that is to use EF 4.0 for persistence. Background Issue First thing I did was add a database to App_Data folder. It shows up on Server Explorer and I can manually add tables via Visual Studio - this should mean that the connection string and permissions and such fine I would think. So, next step. I created an Entity Diagram, built everything "model first" and used the Model to generate the database schema. Using the connection string in web.config, the generated SQL code runs, and says at the bottom of VS, "Disconnected". I go to the Server Explorer, and sure enough there's a red X next to the DB file. I expand the MDF, the little black arrow comes back, showing me I am connected. I try to run it again... and it does the same... "Disconnected"

problem rename sharepoint 2010 search service application admin database

Hi all, i have a problem that hopefully someone has an answer to.  i am not too familiar with sharepoint so please excuse my ignorance. we have sharepoint 2010 on a windows 2008r2 server.  everything seems to work fine.  but as you know, the default database names are horrendous.  i have managed to rename all of them, except for the "search service application" admin database. the default is: Search_Service_Application_DB_<guid> the other 2 databases (crawl and property) were renamed without a problem. we are following the article from technet on how to rename the search service admin db (http://technet.microsoft.com/en-nz/library/ff851878%28en-us%29.aspx).  it says to enter the following command: $searchapp | Set-SPEnterpriseSearchServiceApplication -DatabaseName "new database name" -DatabaseServer "dbserver" however, i get an error about identity being null.  no big deal, i add the -Identity switch and the name of my search service application.  but the real problem comes the error it throws:   Set-SPEnterpriseSearchServiceApplication : The requested database move was aborted as the associated search application is not paused. At line:1 char:54 + $searchapp | Set-SPEnterpriseSearchServiceApplication <<<<  -Identity "Search Service Application" -DatabaseName "ShareP

Questions on Multi-Tenant Data Architecture for SQL Server Database and ASP.NET application

My company wants me to make the same asp.net application and sql server database be sharable amongst different clients. Clients will use the database for their own business use, will have their own data, we will have our own data. How can I share the same SQL Server database amongst different clients having same ASP.NET application (but somehow be able to differentiate which client user is logging in) ? Do I need to use ApplicationID and how will I detect at login which one to use ? I know I will need to add another field in all tables to differentiate client's data from ours.  

ASP.NET MVC2 Empty Web Application creates ASPNETDB database when I try to add user to my own databa

I created ASP.NET MVC2 Empty Web Application, I added my own database called 'Database1' and I added to this database Microsoft users, permissions etc. tables but when I create user in ASP.NET Configuration - it creates in catalog /App_Data database called 'ASPNETDB' and adds users to this database - I don't want that - I have my own database for that - what is going on ??In Web.config my ASP.NET MVC application I have only one connectionString - my own:<add name="Database1Entities" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" /> so what is going on ? How can I add users to my database 'Database1' ?

Suppose we are building a web-based application to retrieve and enter information into a database.

Please help me out with thisSuppose we are building a web-based application to retrieve and enter information into a database.  The user-interface invokes web services.  Which architecture  would use for the application.

how to change the web application Database connection form Windows authentication to SQL Server acco

Hi, I have a web application created and Database connection authentication was given as Windows authentication. how can i change it to a SQL server account in MOSS 2007. Thanks in advance.

Login to Database from Application

Hello, On my SQL Server I have the Security and Logins section.  I usually do the following to access the database from my application: 1 - Create a database on dbo scheme; 2 - Create a Login; 3 - Create a Database Role in the Database and grant the following permissions:      select, insert, update, delete, execute on schema::dbo 4 - Create a Database User and associate it to the Database role and to the Login  Then on my MVC application I use a Connection String with the login to access the database. Can I access the database without the login? Should I make this in some other way? Thank You, Miguel

WPF client application connected to an ASP mySQL database

Dear all, I have a customer who is using an online ASP applciation which provide different type of application. My customer run this app within a browser or a simple local client app which s connected to a remote database accessible via an ADSL connection. Today my customer ask me to build a touch client application and collect those data based on different criteria. According to information I have today it seems that the database is mySQL ( not usre at 100%) In case it is mySQL, does any one has made a kind a gateway between mySQl and .net app when database is hosted remotely ? thnaks for advise if any regards SergeYour knowledge is enhanced by that of others.

claims authenticated (FBA) user cannot open a connection to our custom application database

We have designed a custom sharepoint site. This site uses a membership provider that I implemented, and the users are stored in our custom application database. These are the steps I follow to reproduce the error: 1. Browse to our site. Select Forms Authentication from the default.aspx selection. 2. Enter in a username from our DB table. This user I have configured as a site collection administrator. 3. Login to the site. The user is authenticated by our membership provider and allowed access (ValidateUser returns true) 4. Browse to a page that attempts to connect to the custom app DB. 5. I get the following error when the page attempts to open a connection to our DB: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server NOTES: The code that opens the DB connection is running with SPSecurity.RunWithElevatedPrivileges. Our application pool account has access to the database. My user can connect to the database fine as well as the user that our  application pool is running as. I have validated the connection string that is being used in the debugger, and that is correct.

how to periodically update database file of my wpf application?

Hi, I have a WPF Windows application which we distribute to our clients. The application consists of some database table which changes every month. eg. the application users a  exchange rate table which is valid for one month. What is the best approach to update the data in these table. Please note that the whole application is not changing but only the data in it changing. Please guide me with some options how I can achieve this task. Thank You. Mohamed Ziyad

Uploading excel data to sql database in asp.net application

Hi All,  What is the efficient way to upload excel data to sql database?excel file consists of 4000 rows..so i need to save these records to sql database in web application,i know only by creating ODBC connection i.e_path = @"Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=" + _path;OdbcConnection _xlsConn = new OdbcConnection(_path);_xlsConn.Open();OdbcCommand _xlsSelSht = new OdbcCommand("Select " + columns + " FROM [" + _sheet + "$]", _xlsConn);OdbcDataReader _xlsReader = _xlsSelSht.ExecuteReader();while (_xlsReader.Read()){.....}Is this efficient way ? keeping in mind speed because huge data needs to upload...   thanks in advance...  

How to use LocalDatabase.sdf as standalone Database in Application



I have to create a data driven application for my Utility but the problem is That I can not use a sql server database due to company policy and also I do not have any sql express server.

I tried to use .sdf file as database for my application but I am not able to use it properly as I am not able to insert or update records as it is might be a session type of thing there, I dont know properly

I use it to insert record and select records in next step it works well but when I see it in databse it is blank

I can use xml as well but i am not expert in it and it will be not so easy to use xml as database because insert update delete and select with condition might be difficult in xml.

My database will have 4 tables with relations


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend