Connecting To A Database Twice Fails Because Database Is Uses By An Other Process

Apr 23, 2008

 Hi all,
I come up with a problem aleady discussed in some posts especially in the post http://forums.asp.net/t/1235761.aspx. but I got in not finally solved.
The main problem is connecting to a database twice which causes errors. So I think this might be the right place to ask my questions. 
Here ist the problem in short:
I'm using VWD on XP-Professional with SQL-Server Express and Reporting Services Express. All with Windwos Integrated Security and User Instance (SQLExpress).
In my web-application I had for all Datasources the connect string:
Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|mydatabase.mdf;Integrated Security=True;User Instance=True
This works fine so far.
I also have Reports designed with the Report designer using the same connection string. I can preview the reports and I deployd thre reports successfully. I want to call these report using a report viewer web control.
Now the problem:
when I call the remote remote report from my web-application, the database cannot be opened because an other process is using the database (see post mentioned above). It seems that this is a problem with attaching the database twice: from the sql-server and from the report-server.

So I used now a new connection string without "attaching" the database (in vwd and in report designer):
Data Source=.SQLExpress;Initial Catalog=C:inetpubwwwrootmyappAPP_DATAmydatabase;Integrated Security=True
Now everything works...but ... only on my machine. On the production machine this does not work. I wonder anyway, why its working on my machine, because I never "attach"
the database (there is no connection string with  AttachDbFilename and I have not opend the developer and have not opened the sql management studio).
On the production machine the concurrent (SQL-Server and Report-Server) connection to database does not work with either connection strings, no matter if i attach the database with sql server manager or not).

This all drives me crazy for days now. All I want is to use SQL-server and Reporting- Services with its nice features and not repairing my tools. I thought I have a standard Installation, nothing special, but the standard obviously makes problems.

Here finally my question:
Does this environment ( web-application with remote reports) with Express edition cause normally no problems?
Can I "attach" a database only once?  
How should I connect with my web application that uses the sql-server connections and also  the report-server-connections (attaching twice does not work).
What connection strings to use and when (AttachDbFilename or Initial Catalog).
Are these problems specific to the Express Editions? 
I thank you in advance for any help 
 Dieter

View 2 Replies


ADVERTISEMENT

Right Code Statements Of SqlConnection && ConnectionString For Connecting A Database In Database Explorer Of VB 2005 Express?

Feb 14, 2008

Hi all,

In the VB 2005 Express, I can get the SqlConnection and ConnectionString of a Database "shcDB" in the Object Explorer of SQL Server Management Studio Express (SSMSE) by the following set of code:
///--CallshcSpAdoNetVB2005.vb--////

Imports System.Data

Imports System.Data.SqlClient

Imports System.Data.SqlTypes

Public Class Form1

Public Sub InsertNewFriend()

Dim connectionString As String = "Data Source=.SQLEXPRESS;Initial Catalog=shcDB;Integrated Security=SSPI;"

Dim connection As SqlConnection = New SqlConnection(connectionString)

Try

connection.Open()

Dim command As SqlCommand = New SqlCommand("sp_insertNewRecord", connection)

command.CommandType = CommandType.StoredProcedure
.......................................
etc.
///////////////////////////////////////////////////////
If the Database "shcDB" and the Stored Procedure "sp_inertNewRecord" are in the Database Explorer of VB 2005 Express, I plan to use "Data Source=local" in the following code statements to get the SqlConnection and ConnectionString:
.........................
........................

Dim connectionString As String = "Data Source=local;Initial Catalog=shcDB;Integrated Security=SSPI;"

Dim connection As SqlConnection = New SqlConnection(connectionString)

Try

connection.Open()

Dim command As SqlCommand = New SqlCommand("sp_insertNewRecord", connection)

command.CommandType = CommandType.StoredProcedure
........................
etc.

Is the "Data Source=local" statement right for this case? If not, what is the right code statement for my case?

Please help and advise.

Thanks,
Scott Chang

View 6 Replies View Related

Restore Database Fails Because Database Is In Use.

Jul 23, 2005

I'm a newbie so please be gentle.In attempting to run a restore I get the following error message:"Exclusive access could not be obtained because the database is inuse." However, it doesn't appear that there are any connections to thedatabase. At the suggestion of another thread, I ran sp_who2 and thereare no connections to the database in question. I've been running thesame restore for months and all has been well, until yesterday....I wrote an .asp page (below) to test connectivity to this database.The vb code ran successfully and soon thereafter, my nightly restorefailed. Task manager does no show that the asp page is active.Lastly, I did add a user ("jbtest") as well as change the option to useeither Windows authentication or SQL Server authentication inEnterprise Manager.Any ideas would be greatly appreciated.Thanks.<%@ Language=VBScript %><%companyName = "agemni"Set cnn = Server.CreateObject("ADODB.Connection")cnn.ConnectionString = "DRIVER=SQLServer;SERVER=SHEELA-NA-GIG;UID=jbtest;PWD=test1;APP=MicrosoftDevelopment Environment;WSID=SHEELA-NA-GIG;DATABASE=" & companyName &";Trusted_Connection=No"cnn.ConnectionTimeout = 300cnn.CommandTimeout = 300cnn.OpenSet RS = Server.CreateObject("ADODB.Recordset")strSQL = "SELECT * FROM Preferences"RS.Open strSQL, cnnResponse.Write "connection established with the <b>" & RS("CompanyName") & "</b> database. They are a <b>" & RS("street") & "</b>customer. "RS.CloseSet RS = Nothing%>

View 2 Replies View Related

ASP.net, Database File, Process Cannot Access The File Because It Is Being Used By Another Process

Mar 19, 2008

Hi I am using VWD 2008, SQL Express 2005, Reporting Services, Win-XP, IIS5Basically let's say I have 2 pages:Page1: has a SQLDataSource control that populates a GridView from a table from a database file myDB.mdf  (no code behind)Page2: has a reportviewer control that show a report with data from the same table from myDB.mdf from the reportserver, (no code behind)I have attached myDB.mdf to the SQL Server Express using the SQL Server Management Studio Express.If I first open Page2 to display the ReportViewer it works ok. or using the Report ManagerNow this is the problem:If after that I try to open Page1 then a get an error message:Cannot open user default database. Login failed.Login failed for user 'myServerASPNET'. Exception Details: System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.Login failed for user 'myServerASPNET'.Then I have to restart the SQL Server to fix it,Now I can open Page1 ok, but if after this I try to open Page2 (ReportViewer) againThen I get this error:"      An error has occurred during report processing. o      Cannot create a connection to data source 'my_Datasource'.  &And this error if open the report using the report manager:"      An error has occurred during report processing. o      Cannot create a connection to data source 'my_Datasource'. ยง      Unable to open the physical file "C:InetpubwwwrootWebsiteApp_DatamyDB.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".  &Now if i check the Management Studio Express again, you can see that myDB.mdf was detached. It seems to be there by it has no Tables or definitions, so I have to attach it again..Do you know how to fix this?Thanks in advance,Ed

View 5 Replies View Related

System Process Database Context

Feb 27, 2007

SImon writes "I'm unable to take a user database offline because there are system process using it and I can't identify or kill the system processes"

View 1 Replies View Related

How Can I Process Multiple Binary Files Into My Sql Database?

Aug 1, 2006

i have a table with rows of file names and paths. what i'm trying to do is process each file and store it in my sql database. i want to store the files as binary files (they are word and excel and pdf files) anyone know a way to do this? it would especially be useful if i could do this with a console application so i can schedule it

View 2 Replies View Related

Automating Process Of Database Integrity Checks

Feb 1, 2007

Hi,
I want to automate the process of database integrity checks in sql server any suggestions how to do

View 1 Replies View Related

SQL DTS Package To Process A Remote OLAP Database

Jul 23, 2005

When I start creating a new DTS Package and I choose the Analysis ProcessingTask icon, I only have the option of working with the local MicrosoftAnalysis Server.How can I choose a remote server's Analysis Server in order to process itsdatabase?Thank you

View 1 Replies View Related

Hourly Batch Process Locking My Database

Jul 20, 2005

Hello everyone,I have around 20 reports in an ASP web-application which connects to aSQL Server 2000 dB, executes stored procedures based on inputparameters and returns the data in a nice tabular format.The data which is used in these reports actually originates from a 3rdparty accounting application called Exchequer. I have written a VBapplication (I call it the extractor) which extracts data fromExchequer and dumps the same into the SQL Server dB every hour. Therunning time for the extractor is an average of 10 minutes. Duringthese 10 minutes, while the extractor seems to run happily, my ASPweb-application which queries the same dB that the extractorapplication is updating becomes dead slow.Is there anyway I can get the extractor to be nice to SQL Server andnot take up all its resources so that the ASP web-application users donot have to contend with a very very slow application during thosetimes?I am using a DSN to connect to the dB from the server that runs theweb-application and well as the other server which runs extractor.Connection pooling has been enabled on both (using the ODBCAdministrator). The Detach Database dialog gives me a list of openconnections to the dB. I have been monitoring the same and I havenoted 10-15 open connections at most times, even during the executionof extractor.All connection objects in the ASP as well as VB applications areclosed and then set to nothing.This system has been in use from 2002. My Data file has grown to 450MBand my Transaction Log is close to 2GB. Can the Transaction Log be aproblem. For some reason, the size of the Transaction Log does not godown even after a complete dB backup is done. Once a complete dBbackup is done, doesn't the Transaction Log lose its significance andcan be actually deleted? Anyway this is another post I'm doing todayto the group.In the extractor program,1) I create a temporary table2) I create an empty recordset out of the table3) I loop through the Exchequer records using Exchequer's APIs, addingrecords into the recordset of the temporary table as I go along.4) I do an UpdateBatch of the Recordset intermitently5) I open an SQL Transaction6) I delete all records from the main table7) I run a INSERT INTO main_table SELECT * FROM #temp_table8) I commit the transactionI hope that the information is sufficientThanksSam

View 4 Replies View Related

Database Server Performance Against SSIS Process

Dec 18, 2007

Dear all,

Right now I built an SSIS package to transform data from external source into local database server. I schedule it to be processed at that database server (ex Server A). Is there any difference performance if I replaced the SSIS package to be processed at another server (ex Server B) ? I'd like to separate the process because I want to reduce workload in Server A by removing the SSIS process to Server B. Am I correct ?

Thanks in advance,

Hery

View 2 Replies View Related

Connecting To SQL Database?

Sep 24, 2007

I am very new to web development using Microsoft Visual Studio.  (my primary expertise is Framemaker 2003).  I am currently going through your ASP.NET 2.0 videos and reproducing the lesson content on my development system.  I have Microsoft Visual Studio 2005 Professional Edition.  I also have Microsoft SQL Server 2005, Microsoft SQL Server 2000, Microsoft .NET Framework SDK v1.1 and Microsoft .NET Framework SDK v2.0.
I seem to be having difficulties with the SQL interface because when I try to use the Property object from Lesson04, I get System.Web.HttpExceptioon {"Unable to connect to SQL Server database."}.  When I subsequently tried to Add New Item - SQL Database from Lesson08, I get a Microsoft Visual Studio error box "Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly.  Please verify the installation of the component or download from the URL: http://go.microsoft.com/fwlink/?LinkId=49251"
Any ideas?  I know the videos are based on use of the Microsoft Visual Studio Express -- are there significant configuration differences between it and Microsoft Visual Studio Professional that would make these lessons incompatible?

View 10 Replies View Related

Connecting With Database

Sep 26, 2007

Using web dev  and sql 2005 express
I have published web app and database to my server but can,t get connection string to connect with the database.
---------------------------------------------------------------------
Login failed for user ''. The user is not associated with a trusted SQL Server connection.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Login failed for user ''. The user is not associated with a trusted SQL Server connection.
---------------------------------------------------------------------
I have created a user in the logins   in the sql server security node and give him every permission
going.
I have also created a login  in the security node for the database..... and given him all permissions
But I still can,t get the connection string from the web app to connect to the database?
Where am I going wrong
 

View 5 Replies View Related

Connecting To The SQL Database

Nov 21, 2007

Hi all,
I am new to this field. I am trying to Connect to the database using the following code. The code does not give an error but gives an empty grid view.
Can somebody figure out the mistake?protected void Page_Load(object sender, EventArgs e)
{if (!IsPostBack)
BindGridView();
}void BindGridView()
{
 System.Data.SqlClient.SqlConnection sqlconnect = new System.Data.SqlClient.SqlConnection("");//added connection string here
String command = "SELECT * from table";System.Data.SqlClient.SqlCommand sqlcommand = new System.Data.SqlClient.SqlCommand();
sqlcommand.CommandText = command;
sqlcommand.Connection = sqlconnect;System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter();
da.SelectCommand = sqlcommand;DataSet ds = new DataSet();
sqlconnect.Open();
sqlcommand.ExecuteNonQuery();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
sqlconnect.Close();
}

View 8 Replies View Related

Connecting To An SQL Database

Mar 9, 2008

I have a file called upload.vb and I am having a lot of trouble figuring out how to connect to a database that I have created in my App_Data folder called myDatabase.mdf. Here is the code on for upload.vb Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.IO
Imports System.Data.SqlClient

''' <summary>
''' Upload handler for uploading files.
''' </summary>
'''

Public Class Upload
Implements IHttpHandler, IReadOnlySessionState

Public Sub New()
End Sub

#Region "IHttpHandler Members"

Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
Get
Return True
End Get
End Property

Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

If context.Request.Files.Count > 0 Then
' get the applications path
Dim tempFile As String = context.Request.PhysicalApplicationPath
' loop through all the uploaded files
Dim j As Integer = 0
While j < context.Request.Files.Count
' get the current file
Dim uploadFile As HttpPostedFile = context.Request.Files(j)
' if there was a file uploded
If uploadFile.ContentLength > 0 Then

uploadFile.SaveAs(String.Format("{0}{1}{2}", tempFile, "Uploads", uploadFile.FileName))

End If
System.Math.Max(System.Threading.Interlocked.Increment(j), j - 1)
End While
End If
' Used as a fix for a bug in mac flash player that makes the
' onComplete event not fire
HttpContext.Current.Response.Write(" ")
End Sub

#End Region

End Class Everytime I attempt to create a database connection I get all kinds Compiler errors. If anybody can help me understand how to connect to my database from this page I would greatly appreciate it. Thanks.

View 2 Replies View Related

Connecting To Database Using VB

Jun 19, 2008

I am new to the visual web development program; however, I have created many applications using Visual Studio Express in Visual Basic.  I am trying to figure out how to:1.  Define a connection string in VB2.  Open a current Connection3.  Define a SqlStatement4.  Retrieve the information5.  Display results in textboxI am basically trying to get a login system set up so that a user can type in his name and password and is then directed to a secure page.When I create a new application and want to do this I would use the following code: Dim cnUsers As New SqlClient.SqlconnectionDim cnUsersString As String = "CONNECTION STRING"Dim UserCommand As NEw SqlClient.SqlCommand = "Select chrUsers, chrPassword FROM tblUsers WHERE chrUsers = '" & txtUserName.Text & "' AND chrPassword = '" & txtPassword.Text & "'" cnUsers.ConnectionString = cbUsersStringcnUsers.Open()UserCommand.Connection = cnUserstxtResults.Text = cnUsers.ExecuteNonQuery()cnUsers.Close() That is a very rough draft of what I would code it as.  If you have any suggestions please let me know! - NUStudent- 

View 2 Replies View Related

Connecting To A Database

Nov 19, 2005

I have an SQL database setup but i don't know how to connect to it to set up a table.  I have a vague idea about connectionstrings and such.  I have a server name, a database name, a user id and a password.  I would like to set it up so i can just enter the SQL commands and create a table and enter data.  But first I need to connect to the database.  I

View 1 Replies View Related

Connecting To SQL Database

Nov 29, 2005

I am moving my site from a shared environment to a dedicated server and SQL is on the same box. How do I connect to my database if it's on the same box?

View 4 Replies View Related

Connecting To SQL Database

Apr 25, 2006

Hi all,
 
Please help me with the following problem because I am running around in circles.
 
I have this problem getting a forum online.
Since it is a database related problem which I have been trying to solve at the ClubSite forum I am taking the liberty to come to this forum with this problem.
 
This is the story:
I have this separate SQL database dotForum2004.mdf in App_data.
After trial and error got it working locally.
 
But when I put it online at my webserver (On a Stand-alone PC at my jobsite) I get an application error.(From the Club Site application)
 
This is the connection key which works fine locally. Is there something obvious you can point me at?
 
<add key="forumDSN" value="Provider=SQLOLEDB; Server=.SQLExpress;AttachDbFilename=|DataDirectory|dotForum2004.mdf;Trusted_Connection=Yes;" />
 
Thanks in advance,
Lex

View 5 Replies View Related

I Need Help With Connecting To A SQL Database...

May 2, 2007

For an assignment at school, I need to build an ASPX web page that looks up books in a database. This entails the use of a SQL database, and I am having issues trying to connect to the database.

here is a pic of the error I am getting:



I am using Visual WebDeveloper 2005 Express to do this in, and I can't find any options that pertain to the error above. I looked in the SQL configuration tools that I have installed, and I can't seem to find the correct options that I need.

Does anyone know how to resolve this? If you can provide direction on this, that would be great.

View 3 Replies View Related

Help Connecting To SQL Database

May 2, 2004

Hi. I'm totally new here, and I'm not an expert when it comes to SQL, so bear with me. This is my dilemma:

I use Access 2000 to connect to my Microsoft SQL Server 2000 database. Recently, our provider switched us from a shared server to a dedicated server. The site is up and running perfectly, but I can't connect to my database via Access anymore. Once I received the new location of the database, I ran odbcad32.exe and configured the database's DSN info where appropriate. I run the "Test Data Source..." function and the tests are seemingly successful. When I open my database using Access, I'm able to log in successfully, but when I click on any one of my linked tables, I get the following error:

Could not execute query; could not find linked table.

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
'NAMEOFDATABASE.NAMEOFTABLE'. (#208)

The support team at my provider are not exactly geniuses, so who knows if and when they'll be getting back to me. In the meantime, does anyone have a clue what might be causing this? Since the site is working perfectly, I assume the connection strings are okay and the database is perfectly intact (I even checked to see that the most recent entries were live), so what gives? If there's any more info I can provide, let me know. Thanks in advance.

View 6 Replies View Related

Connecting To Database With C#

Jun 2, 2008

Hi, I will post this on a c# forum as well but maybe someone has an answer here.

I want to connect to my database in a program i am coding with C#.
I have 3 databases in my SQL server (DB1, DB2, DB3)(perhaps schemas is the word to use) all under a connection called TEST (as opposed to SQLEXPRESS.

My connection string in my code is as follows:
string ConnectionString = "Data Source=.\TEST;Integrated Security=True;Connect Timeout=30;User Instance=True;";

My app reports a valid connection is made. WooHoo.
But,
When i try to do a select statement eg: Select * from DB1.Customers
I get the following error.
System.Data.SqlClient.SqlException: Invalid object name 'DB1.Customers'

I have tried removing the DB1. part from the select statement and specifying Database = DB1 in my connection string but that doesnt work either.

Any help provided would be greatly appreciated.

Thanks.

View 2 Replies View Related

Connecting To Database

Sep 17, 2007

hi,

i have to give connection string in .cs file
as SQLConnection cn=new SQLConnection("")

i have to connect to local computer..please anyone provide me solution.
datbase is northwind...and i m connected it with windows authentication..
please any one provide me answer....

View 5 Replies View Related

Connecting To SQL Database With VB.net

Feb 20, 2008

I'm completely new to this, so as much detail as you can provide is appreciated.

I have a SQL database called "WebDesk.mdf" and I have a ASP.Net web application. I can't figure out the connection string I need to connect to this database. It doesn't matter if I connect to it as a file, or otherwise.

Please tell me all the steps I need to get the connection string.

-Dan

View 3 Replies View Related

Help With Connecting To SQL Database And Binding

Jun 30, 2006

I am new to .net and I am using Visual Web Developer 2005 Express with SQL Server 2005 Express.  What I would like to do is connect to my SQL database (which resides in the app_data folder) and open a table and pull out a field and place it in either a textbox or label on the page. No editing or deleting. Just simple one field binding.  By the way, I can do this with all the cool built-in tools of VWD, but I want to know how to do it all by hand.  I would really appreciate it if someone could help me out.

View 3 Replies View Related

Having Trouble Connecting To Database

Aug 19, 2006

Hi I am new at this.   
I have a little program written in C# in asp.net.  The program basically accesses a database and stores new records.  The database is supposedly already attached to MSDE so I am able to see the tables of the database inside asp.net.   I can click on the individual slots of the table and modify the datas manually.  However, I want to connect to the database from my C# program and be able to input data into the database via the website that the C# program produces.  After I type in the data into the website and click the submit button on the website, I get an error page that says this:
Login failed for user 'sa'
the line of code thats causing this error is:
con = new SqlConnection("data source=(local)\NetSdk; initial catalog=Friends; user id=sa");
Why is it not able to connect to the database?

View 2 Replies View Related

Connecting To Remote Database?

Feb 3, 2007

I am using SQL Server 2000 database in my VB.Net project.
My VB.net application is installed one two machines in different cities i.e. there are two separate databases.
First machine's IP address is say 202.33.44.55 and other machine IP address is say 203.33.55.66. Now I want to use each others databases i.e. I want to set their database group.
So that in my VB.Net's application which is installed on 202.33.44.55 I could see data of the 203.33.55.66 by just changing the connection string

View 9 Replies View Related

Having Some Trouble Connecting To A Database....

Feb 13, 2007

I am doing one of the Microsoft virtual labs "Creating ASP.NET Web Applications with C# - Part 2" using Visual Web Developer Express. I am trying to fill a gridview with database information, but it gives me the error "An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)".This is on the local machine that I am executing the code.  public void BindGrid(string sortfield)
{
//Create DataAdapter to fetch data from Prodcuts table
SqlDataAdapter myCommand = new SqlDataAdapter("select * from Products", myConnection);
//Create dataset and fill it with Product data
DataSet ds = new DataSet();
myCommand.Fill(ds, "Products");
//Bind Product data to Datagrid
DataView Source = ds.Tables["Products"].DefaultView;
Source.Sort = sortfield;
dgProducts.DataSource = Source;
dgProducts.DataBind();
} It stops on the line "myCommand.Fill(ds, "Products"); and points out the error mentioned earlier. I am not sure what to do...any help would be greatly appreciated, thanks in advance, and I apologize as well if I have not pointed out enough information.

View 4 Replies View Related

Error Connecting To Database

Mar 10, 2007

Hi guys,
 I created a database using SQL Server EXpress edition but now i need to use SQL Server Development edition. I cant connect to the database now?
Anyone tell me what the problem is.
 
 

View 2 Replies View Related

MS SQL Database Not Connecting Problem

Aug 18, 2007

hiI usually did my database in  SQL Server Management Studio Express then when I was in Visual Studios I would connect to it in the server explorer tab but I wanted to try to do it through Visual studios so I took my database files then went to my app_data folder and added them as existing items. I then went back to the server explorer tab and set it up.Everything thing seemed to set up but when I run it I get an error. I get this error when it does conn.Open(); Error: 1 System.Data.SqlClient.SqlException was unhandled by user code
2 Message="Cannot open database "Japanese" requested by the login. The login failed.
Login failed for user 'HOWSER\chobo'."
3 Source=".Net SqlClient Data Provider"
4 ErrorCode=-2146232060
5 Class=11
6 LineNumber=65536
7 Number=4060
8 Procedure=""
9 Server="localhost\SqlExpress"
10 State=1
11 StackTrace:
12 at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
13 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
14 at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
15 at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
16 at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
17 at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
18 at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
19 at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
20 at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
21 at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
22 at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
23 at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
24 at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
25 at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
26 at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
27 at System.Data.SqlClient.SqlConnection.Open()
28 at Practice.Page_Load(Object sender, EventArgs e) in h:WebsiteJapanesePractice.aspx.cs:line 28
29 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
30 at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
31 at System.Web.UI.Control.OnLoad(EventArgs e)
32 at System.Web.UI.Control.LoadRecursive()
33 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
34 This is what I have as my connection stuffwebconfig 1 <connectionStrings>
2 <add name="Japanese" connectionString="Server=localhostSqlExpress;
3 Database=Japanese; Integrated Security=True"
4 providerName ="System.Data.SqlClient"/>
5 </connectionStrings>
6
7 In my file 1 SqlConnection conn;
2 SqlCommand comm;
3 SqlDataReader reader;
4
5 string connectionString = ConfigurationManager.ConnectionStrings["Japanese"].ConnectionString;
6 conn = new SqlConnection(connectionString);
7
8 comm = new SqlCommand("SELECT HiraganaCharacter,HiraganaImage FROM Hiragana", conn);
9 conn.Open();
10 reader = comm.ExecuteReader();
 Thanks    

View 1 Replies View Related

2 Errors When Connecting To Database!

Sep 7, 2007

Hi,
 I uploaded my website to a server and I face some problem to connect with the data base
In the website I have one databse that combaine the asp.net membership and roles tabels
when I try to login the website I got this error
An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
I use the login control
+++
another error I get it when I request data from tables other than the member ship and roles tables,
the error is
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The certificate's CN name does not match the passed value.)
 
maybe the second error related to the first becouse in the second stuation I also request the userName wich comes from the membership's table
 
Please, advise me to solve these problems
 

View 3 Replies View Related

Error Connecting To Database - Please Help

Oct 11, 2007

When i am trying to connect to SQL Server(Express edition) on production server i am getting the following error.
"An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - No such host is known.)" My SQL connection string is like this which i wrote in web.config.
<add key="conn1" value="Data Source=xxx.xxx.x.xxxyz,1433;Initial Catalog=abcdef_xyz;persist Security Info=true;User ID=xx;Password=xxxxxx"/>
string constr = ConfigurationManager.AppSettings["conn1"]; SqlConnection con = new SqlConnection(constr);
con.Open();
When i searched microsoft help to resolve this error, it suggested me to enable TCP/IP protocol for SQL server, i did that, but even after doing that i am still not able to connect to the database. Could any one please tell me what else i need to configure in order to connect to the database.
Thanks

View 2 Replies View Related

Connecting My Function To The Database

Nov 20, 2007

Hi i have written a function which will inset data into my database, when the function is called from a page, my only problem now is how to connect it to the database, in other words how the function will communicate with the database, this is the code  i have written below including a connection code however it doesnt seem to work, can someone help me on my way, thank you
//Build SQL Query static public string buildQuery(string strAction, string strTableName, string[,] strData, string[,] strWhere, string strWhereOverride, string strLimit, string strOffset, string strOrderBy)
{SqlConnection SqlConn = null;
SqlCommand SqlCmd = null;String strConnection = null;
String strSQL = null;strConnection = ConfigurationManager.AppSettings["strConnectionString"];
SqlConn = new SqlConnection(strConnection);
SqlConn.Open();
//Ucase
strAction = (strAction);
//Dimension
//string strSQL;long lngIter;
long lngCount;string strPart1 = "";
string strPart2 = "";
//Build first part strSQL = strAction + " ";
//Build Insert Query if (strAction == "INSERT")
{
//Next part of query strSQL = strSQL + "INTO " + strTableName + " ";
//Build data part of query lngCount = Convert.ToInt32(strData.GetUpperBound(1));for (lngIter = 0; lngIter < lngCount; ++lngIter)
{if (strWhere[lngIter, 0] != "")
{
//Build Column Name Part strPart1 = strPart1 + "`" + strData[lngIter, 0] + "`,";
//Build Column Data Part strPart2 = strPart2 + (char)34 + strData[lngIter, 1] + (char)34 + ",";
}
}
//Concatenate strSQL = strSQL + "(" + strPart1.Substring(1, Strings.Len((strPart1)) - 1) + ") values (" + strPart2.Substring(1, Strings.Len((strPart2)) - 1) + ")";
}
//Build where part strPart1 = "";
//Iterate if (strWhereOverride == "")
{lngCount = Convert.ToInt32(strWhere.GetUpperBound(0));for (lngIter = 0; lngIter < lngCount; ++lngIter)
{
//Ensure is not empty if (strWhere[lngIter, 0] != "")
{
//Use default compare of equal but allow override string strCompare = "="; ;
//If override is present then use if (strWhere[lngIter, 2] != "")
{
strCompare = strWhere[lngIter, 2];
}
//Build where strPart1 = strPart1 + strWhere[lngIter, 0] + strCompare + strWhere[lngIter, 1] + " and ";
}
}
//Concatenate strSQL = strSQL + " WHERE " + strSQL.Trim(strPart1.Substring(1, Strings.Len(strPart1) - 5).ToCharArray());
}
else
{
//Concatenate strSQL = strSQL + " WHERE " + strWhereOverride;
}
//if Orderby if (strOrderBy.Length > 2)
{strSQL = strSQL + " ORDER BY " + strOrderBy;
}
 return strSQL;
}

View 6 Replies View Related

Error Connecting To Database

Nov 21, 2007

I get the following error:
An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
How do I correct it?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved