Not Connecting To SQL Database Anymore

Nov 18, 2004

I have the following code in my ASP program
dbRows = Server.CreateObject("ADODB.Recordset");
dbRows.Open( dbCmd );
dbCmd.Parameters.Delete("@reset");

newUser=((dbRows.EOF) || ((!dbRows.EOF) && (dbRows("isActive").value != 1)) )
if ( newUser ) {
if(Request.ServerVariables("SCRIPT_NAME") != "/profile_edit.asp" ) {
Response.clear();
Response.Redirect("/newuser.asp");
}
} else {
Session("logon_user") = Request.ServerVariables("LOGON_USER")+"";
Session("fullname") = dbRows("full_name").value;
Session("email") = dbRows("email_address").value;
Session("q1") = dbRows("q1").value == " " ? "" : dbRows("q1").value;
Session("q2") = dbRows("q2").value == " " ? "" : dbRows("q2").value;
Session("q3") = dbRows("q3").value == " " ? "" : dbRows("q3").value;
Session("ct") = dbRows("ct").value == " " ? "" : dbRows("ct").value;
Session("so") = dbRows("so").value == " " ? "" : dbRows("so").value;
Session("graphic_level") = 3;
Session("er_view") = dbRows("er_view").value;
dbRows.close();
gLev=Session("graphic_level");

dbCmd.CommandText = "knet_user_setLastLogin"
dbCmd.Execute();


This same code used to work but doesn't anymore. The connection times out and the error points to the dbCMD.Execute command. Here same things I have found:
1. If I point the database calls to the development server it works. If I point the database calls to the production server it fails. I am to get to production through other calls just fine.

2. If I comment out the dbCmd.Execute or dbCmd.CommandText = "knet_user_setLastLogin" seperately the code works.

What is the dbCmd.Execute doing when it is called?
Could it be a problem with the store procedure?
Could it be a software upgrade on the Database server that is causing the problem?

Your help will be greatly appreciated.

Thanks,
Craig-

View 4 Replies


ADVERTISEMENT

Unable To Access Database Anymore

Nov 14, 2007



Hi,

I'm unsure what happened, but I'm using SQL Server 05 Developer Edition. I've been working with a local database where I tried to add a clustered index on a huge table (about 50M records). Well, I had to stop the query since it was maxing out my work computer. Since then, I've been unable to open the database or run queries against it.

When I open SQL Server Management Studio the database says In Recovery. Once it's done, when I try to expand tables, I eventually get this error:

TITLE: Microsoft SQL Server Management Studio
------------------------------
Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
Lock request time out period exceeded. (Microsoft SQL Server, Error: 1222)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=1222&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------



If I run a Select * from INFORMATION_SCHEMA.TABLES query, it will go on for a while

If I try to access the properties of the Database (right clicking), I get this error:

TITLE: Microsoft SQL Server Management Studio
------------------------------
Cannot show requested dialog.
------------------------------
ADDITIONAL INFORMATION:
Cannot show requested dialog. (SqlMgmt)
------------------------------
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Lock request time out period exceeded. (Microsoft SQL Server, Error: 1222)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=1222&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
I'm unsure where to go from this point forward.

View 11 Replies View Related

SQL Server Express: Restore, Backup And Attach Do Not Work Anymore && Database Locations Fault

May 7, 2008

Hello there,

I've some really big problems with SQL Server 2005 Express. I Recently, I had 2 instances on my machine, one was a SQL Server 2000 Developer and the other a 2005 Express Version. The 2000 version was not necessary anymore, so I unstalled it, since then, the Express version keeps having probems.

Under the Server Properties -> Database settings -> Database Locations I've changed the path to D:sqldatamssql, but now, the programm always takes the "C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLData" to store and load the databases, no matter what I do.

And there are more problems see here:

Restoring does not work=======================
I wanted to restore a database called "fw40_admin" from a backup file (.bak), but that didn't work at all, it always says this as an error:

"System.Data.SqlClient.SqlError: The operating system returned the error '5(error not found)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'D:sqldatamssqlfw40_admin.mdf'. (Microsoft.SqlServer.Express.Smo)"

But as soon as I type in the installation path "C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLData" inside the "Restore As" under "Options", it works.

Why does the backup only work in "C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLData", BUT the database locations under the server properties is indicated with "D:sqldatamssql"????


Attaching does not work=======================
Attaching an existing database does not work either. Most databases (mdf) are located on the path D:sqldatamssql, but as soon as I press

Attach Databases -> Add

The dialog window appears with the "D:sqldatamssql" path, but it is unable to find any *.mdfs altough THERE ARE .mdfs in this directory. But Express can find databases in the selected installation: "C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLData".
Why can't Express see the directory on the D: partition???


What is wrong? Here? Can anybody help me?

View 5 Replies View Related

Can't Connect To My Server Anymore.

Apr 5, 2000

I've got SQL 7.0 installed on a desktop to develop DTS packages. I've been using it fine for a month or so. Now, all of the sudden, I cannot connect to the server using Enterprise Manager, SQL Analyzer or anything. I get an error stating 'Connection could not be established: ConnectionTransact(GetOverLappedResult())'. The error log states that the max number of connections has been reached. Also, when restarting the server, there is an inticonfig statement that's says it's only allowing one connection. Why? Nobody/nothing else is connected to this server. How do I change it so it'll allow more than one connection? I can't connect to change this setting.

Any help would be appreciated.
Thanks,
sjl

View 1 Replies View Related

Enterprise Manager Won't Let Me In Anymore?

Oct 24, 2000

Hi,
I'm using SQL Server 7 and have it installed on one PC, Not networked.
Without any explanation Enterprise manager won't let me look at my databases. It lets me look at a server on the web but not my own Server on this PC.

It has worked without any problems until now. I receive this message when I try and look at the servers databases.

**A connection could not be established to H3G5Z8- Cannot open user default database <ID> using master database instead.

Please verify SQL Server is running and check your Server Registration properties.

*********************
Total mystery right out of the blue.

Appreciate any help you could give me.

Steve

View 2 Replies View Related

Cannot Create ADO Connection To DB Anymore...

Jul 20, 2005

I rebuilt my machine a few weeks back - re-installed the developer version...The app in question can see all it's tables in the SQL back end via ODBC andeverything looks normal via Enterprise Manager, but I can no longer createan ADO Connection.Source code is unchanged, what's changed is the PC rebuild and consequentre-installatin of SQL Server developer version.I suspect it's something to do with the provider (at least that's the only thingI can see in the .Connect string that's not verifiably correct....)The error looks like this after I trap and format it:-----------------------------------------------------------------12/30/03 21:34:30v0.71 Userid: UPQC on SAGProc: basADO: ADO_ConnectionCreate-2147467259: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server doesnot exist or access denied.Errors encountered when trying to connect:''''''''''[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist oraccess denied.----------Connect String:Provider=SQLOLEDB.1;SERVER=SAG;DATABASE=TRETS;UID= Trets;PWD=trets-----------------------------------------------------------------Can anybody see anything obvious to look for?I'm thinking I need to know how to verify/validate the presence of provider"SQLOLEDB.1"... But how?--PeteCresswell

View 1 Replies View Related

Package Doesn't Run Anymore On SP2

Feb 26, 2007

Hi all,

I've installed SP2 on my server. If I run the package on the server, the package worked there before the installation of SP2. Now with SP2 it doesn't work anymore. In VS2005 on my computer the package works before and after the installation of SP2.

He gives an error with the execution of a sql-task on an oracle server:

Error :Executing the query "insert into cube_content values (trim(?), trim(?), trim(?), trim(?), trim(?), sysdate) failed with the following error: "ORA-01401: inserted value too large for column". Possible failure reasons: Problems with the query, "ResultSet property not set correctly, parameters not set correctly, or connection not established correctly.

Anybody an idea?



Thanks,

Dennis





View 3 Replies View Related

...Works In Management Studio, Not In .NET Anymore

Jul 3, 2007

I have an ASP.NET/ADO.NET page i wrote. It was based off of the development database during most development, and it switched over seamlessly to the production database.

Except for yesterday, when i went back to edit the page. It simply stopped returning results on my queries. To see if it was caused by bad values being passed to the sqldatasource, i tried it in the "Configure Data Source..." window, and it returns zero rows. When passing all of the exact same parameters to the same procedure in the same DB engine, even using the same login information, it works.

Just not in my ADO.NET app anymore...

Can anyone tell me what the hell could be going on here, please? I already rebuilt the page from an older version this morning, being very minimal on changes, and the last thing i changed before it stopped working was the connection string... *BUT* I have triple-checked that against the canon string we have always used in every working copy.

I'm losing a lot of hair over this . Any help would be greatly appreciated.

Thanks in advance

stoland

View 2 Replies View Related

HelloWorld_CLR Not Sending Messages Anymore...........

Nov 15, 2006

Hello,

Yesterday I made the HelloWorld_CLR sample work and figured today I would create a simple windows service to immulate its functionality.  When this was not working I tried the sample again and it stopped working.  I have tried several things and nothing has worked.  Has anyone seen this before or have any ideas on how I can get it working again?  I even tried removing SQL Server and its samples then reinstalling to give me a clean slate but that did not work.  I did not make any changes to the software nor did I make any changes to the database however the sample did so I need to make sure I can fix this incase it happens in development not to mention I need to continue development.

The Client Queue is normally empty but sometimes has a request to two in it.  The Server Queue has alot in it that are both Request and an unspecified type or has a URL for a type.  I would paste it in but it takes too much space.  Please let me know if you have any ideas because I am not sure what else to try.

Bellow is a sample of the output from running this sample.

Connecting to SQL Server instance
Connected to SQL Server instance

Transaction 1 begun
Dialog begun from service (HelloWorldClient) to service (HelloWorldService)
Message sent of type 'Request'
Transaction 1 committed

Transaction 2 begun
Waiting for Response....
No message received - Ending dialog with Error
Transaction 2 committed

Connection closed - exiting

Press Enter to Exit


Thanks,
Scott Allison...

View 3 Replies View Related

Unable To Open DTS Packages Anymore

Nov 10, 2006

Hi,

I installed the dts designer component for 2005 so I could migrate over some 2000 packages and was able to successfully open and run dts packages under 2005.

Then all of a sudden I get this error msg and can't open them, migrate them, export them, etc:

"here were errors loading the package "MyPackageName":
[DNETLIB][ConnectionOpen (Invalid Instance()).] Invalid connection.
(Microsoft.SqlServer.DtsObjectExporerUI)"

That is not a typo, it actually says "here were errors..." instead of "There were errors..."

I've tried the obvious, repair the dts designer component and rebooting, no luck.

Anybody seen this?

Hope this is the right group to post to...

Thx

View 5 Replies View Related

I Can Not View Report Manager Anymore

Oct 13, 2007

When I try to run my report manager which is in my local machine, I get the following error message.

The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing. (rsReportServerDatabaseUnavailable) Get Online Help




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)



I can not open Report server data base and reportserver temperary data base, even in Management Studio. I can not see them there anymore.

Also When I try to open data base engine in my local machine through Management Studio, I can not open it. I get the following error massege.

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) (.Net SqlClient Data Provider)


Recently, I changed data base connection properties of all my reports. coz earlier I used a data base which was in the local machine. But then I connected all my reports to the same data base which is on another server. Then I changed all connection properties of each report. After that I deleted the data base in the local machine.

Would that be the reason for this problem?

Also SLQ server(MSSQLSERVER) and SQL Server Agent has been stopped running. I can not start it from SQL Server Configuration Manager.


Please can anyone tell me how to fix this problem and get my work done as usual?

View 6 Replies View Related

Auto Grow For DB Doesnt Work Anymore

Jul 3, 2001

Hello all!

I've a problem with my database. Till yesterday the option for Auto Grow of Database (10 %) was working very fine, but now it seems to be some problems with it. Finally I had to specify a restricted size for the database and then it again startd to give me some space in the database to write in. Ideally it should have worked automatically, isnt it ???

There is no problem with the space on the drive, I still have some 76 gb of free space there ...

Thanks in advance ...

Anjä

View 1 Replies View Related

Since Uninstall Of ADAM Service Does Not Start Anymore

Sep 6, 2005

hideho,

View 6 Replies View Related

SSIS Doesn't Start´anymore After SP1 Installation

May 2, 2006

Hi everyone,

I've a problem which I think a lot of SQL Server 2005 users had already ...however I didn't found any answers so far. Maybe anyone of you might know.

I have installed SP1 for SQL Server 2005 on 2 systems, one is an Enterprise Edition (english) on a Win. 2003 SP1 system and one is a Developer Edition (also english) on a Win. XP Prof. system.

On both systems the installation process of the SP1 worked fine except that it gave me the message "Reboot required" on the step installation of SQL Server Native Client.

After my reboot I reexecuted the installation of SP1 with the result of no error nor reboot message. Everything seemed fine....

However when I checked the status of the services I recognized that the SSIS has switched from LOG ON AS ...my specific login.... to NT AUTHORITYNetworkService and the automatic startup failed.

I tried to change the login to my previous login which also failed. It tried to change it to any other possible login but the startup with all logins failed with the error message:

The service did not respond to the start or control request in a timely fashion.

The event log of the system does tell me the same error message. The summary log of the SP1 installation doesn't show any error or warning message except "Failed to read registry key: Debug". Enclosed is the log file:

05/02/2006 22:11:09.609 ================================================================================
05/02/2006 22:11:09.625 Hotfix package launched
05/02/2006 22:17:22.296 Attempting to install instance: SQL Server Native Client
05/02/2006 22:17:22.312 Attempting to install target: MHPA0F7C
05/02/2006 22:17:22.312 Attempting to install file: sqlncli.msi
05/02/2006 22:17:22.328 Attempting to install file: e:de43f41a74855a4cfc41014b760758HotFixSqlncliFilessqlncli.msi
05/02/2006 22:17:22.328 Creating MSI install log file at: D:WINNTHotfixRedist9LogsRedist9_Hotfix_KB913090_sqlncli.msi.log
05/02/2006 22:17:22.343 Successfully opened registry key: SoftwarePoliciesMicrosoftWindowsInstaller
05/02/2006 22:17:22.343 Failed to read registry key: Debug
05/02/2006 22:17:38.437 MSP returned 3010: A restart is required to complete the install. This message is indicative of a success. This does not include installs where the ForceReboot action is run. This error code is not available on Windows Installer version 1.0.
05/02/2006 22:17:38.515 Successfully opened registry key: SoftwarePoliciesMicrosoftWindowsInstaller
05/02/2006 22:17:38.515 Failed to read registry key: Debug
05/02/2006 22:17:38.515 Pending reboot, successfully installed file: e:de43f41a74855a4cfc41014b760758HotFixSqlncliFilessqlncli.msi
05/02/2006 22:17:38.515 Successfully installed target: MHPA0F7C
05/02/2006 22:17:38.515 Successfully installed instance: SQL Server Native Client
05/02/2006 22:17:38.515
05/02/2006 22:17:38.515 Product Status Summary:
05/02/2006 22:17:38.515 Product: SQL Server Native Client
05/02/2006 22:17:38.515 SQL Server Native Client (RTM ) - Reboot Required
05/02/2006 22:17:38.515
05/02/2006 22:17:38.515 Product: Setup Support Files
05/02/2006 22:17:38.515 Setup Support Files (RTM ) - Not Applied
05/02/2006 22:17:38.531
05/02/2006 22:17:38.531 Product: Database Services
05/02/2006 22:17:38.531 Database Services (RTM 1399 ENU) - Not Applied
05/02/2006 22:17:38.531 Analysis Services (RTM 1399 ENU) - Not Applied
05/02/2006 22:17:38.531 Reporting Services (RTM 1399 ENU) - Not Applied
05/02/2006 22:17:38.531
05/02/2006 22:17:38.531 Product: Notification Services
05/02/2006 22:17:38.531 Notification Services (RTM 1399 ENU) - Not Applied
05/02/2006 22:17:38.531
05/02/2006 22:17:38.531 Product: Integration Services
05/02/2006 22:17:38.531 Integration Services (RTM 1399 ENU) - Not Applied
05/02/2006 22:17:38.531
05/02/2006 22:17:38.531 Product: Client Components
05/02/2006 22:17:38.531 Client Components (RTM 1399 ENU) - Not Applied
05/02/2006 22:17:38.531
05/02/2006 22:17:38.531 Product: MSXML 6.0 Parser
05/02/2006 22:17:38.531 MSXML 6.0 Parser (RTM ) - Not Applied
05/02/2006 22:17:38.531
05/02/2006 22:17:38.562 Product: SQLXML4
05/02/2006 22:17:38.593 SQLXML4 (RTM ) - Not Applied
05/02/2006 22:17:38.687
05/02/2006 22:17:38.687 Product: Backward Compatibility
05/02/2006 22:17:38.687 Backward Compatibility (RTM ) - Not Applied
05/02/2006 22:17:38.687
05/02/2006 22:17:38.687 Product: Microsoft SQL Server VSS Writer
05/02/2006 22:17:38.687 Microsoft SQL Server VSS Writer (RTM ) - Not Applied
05/02/2006 22:17:38.687


I know there are a lot more LOG files in the directory ..HotFix.. which might tell more about the problem. However I don't know in which file I have to look.

Can anyone help me?



Regards,

Stefan

View 8 Replies View Related

Filtering Duplicates In SQL2005 Doesn't Work Anymore

Aug 18, 2006

Hi,

Made the jump from SQL2000 to 2005 - i'm not a DBA but like to play around with such nice tools- and tried to convert my DTS package into a 2005 one.

I've got a csv file containing some log in information.

As users log in everyday, this keeps getting added to the file.

I'm only interested in the latest appearance of a certain machine on the network so i filter by creating an unique Index

the CSV file get's imported into a temporary table first and then i executed the following on SQL2000



CREATE TABLE [patchings].[dbo].[allfilter] (

[username] varchar (20) NULL,

[machine] varchar (20) NULL,

[os] varchar (20) NULL,

[sp] varchar (20) NULL,

[date] smalldatetime NULL,

[time] varchar(10) NULL,

[logonserver] varchar (20) NULL,

[country] varchar (20) NULL,

[domain] varchar (20) NULL,

varchar (20) NULL,

[brand] varchar (20) NULL,

[model] varchar (20) NULL,

[speed] int NULL

)

CREATE unique INDEX [my filter] ON [dbo].[allfilter]([machine], [os]) with ignore_dup_key ON [PRIMARY]

go

insert into "Allfilter" select * from temptable order by date desc

This worked perfectly in SQL2000.

when i try to do the same in SQL2005, it doens't start inserting the most recent machines (filtered on the date) but machines at random



selecting the select * from temptable order by date desc shows me the correct order for the machines by date so i'ld presume that it adds the most recent combination of machine and operating system from "today" and ignores the older appearances.

if the temptable contained for instance..

MY-MACHINE MY_USER Windows XP Service Pack 2 2006/06/13 10:02:34 Mydomaincontroller BE MY_DOMAIN my_ip IBM type 2593
MY-MACHINE MY_USER Windows XP Service Pack 2 2006/06/15 9:59:59 Mydomaincontroller BE MY_DOMAIN my_ip IBM type 2593
MY-MACHINE MY_USER Windows XP Service Pack 2 2006/06/16 12:33:09 Mydomaincontroller BE MY_DOMAIN my_ip IBM type 2593
MY-MACHINE MY_USER Windows XP Service Pack 2 2006/06/19 10:48:56 Mydomaincontroller BE MY_DOMAIN my_ip IBM type 2593
MY-MACHINE MY_USER Windows XP Service Pack 2 2006/06/20 11:03:49 Mydomaincontroller BE MY_DOMAIN my_ip IBM type 2593



under SQL2000 i'ld see one record in the final "allfilter" table

MY-MACHINE MY_USER Windows XP Service Pack 2 2006/06/20 11:03:49 Mydomaincontroller BE MY_DOMAIN my_ip IBM type 2593

under SQL2005 i don't see the last one though coding is the same

MY-MACHINE MY_USER Windows XP Service Pack 2 2006/06/16 12:33:09 Mydomaincontroller BE MY_DOMAIN my_ip IBM type 2593


I guess i'm missing something here but what?

Tnxs

K

View 1 Replies View Related

Cannot Import/link Data From DBase With SQL Server DTS Nor Access Anymore..

Jul 20, 2005

Hi,SQL Server 2000 SP3Windos 2000 Server SP4I have a DTS package that imports data from a dBase IV databse withfiles located in two folders (dBF1 and dBF2). I use a transform datatask to transform the data.They were running properly, but last week we installed W2K SP4, andnow the transform task for files from dBF2 are not working properly.I have two tranform tasks to extract data from files in dBF2 folder.If I double click to open the transform data task of either of them,Enterprise Manager crashes with the errrormmc.exe applicatio ErrorThe instruction "xxxx" referenced memory at "xxx". The memory couldnot be read.Althoug the transform task for one of the files will run, the otherwill not run giving the messageError Source: DTS packageCatastrophic failureAlso, I have an Access database that has links to the same dBasefiles. For files from dBF2 folder, I'm able to see the data from oneof the files, but if I double click to see the data from the other,access crashes with no specific error message. Nothing has changed ondBase related files (permission wise).The transform tasks to extract data from the other dBase folder (dBF1)files are working fine, and data is accesible from Access.Any advice how to tackle this one?

View 2 Replies View Related

After Set New_broker, It Works For Half Hour And Don;t Work Anymore, Please Advise, Thanks!

Sep 10, 2006

I use ASP.NET 2.0 and SQL 2005, the SQLCacheDependency didn't work stable for me, it usually works and after a while, it stops working. Recently, It doesn't work. Today I reset service broker by

Alter DB set new_broker

It seems all work, but too early to be happy, it doesn't work now anymore. I don't see any record in

sys.transmission_queue

And I don't see new entries in

sys.dm_qn_subscriptions neither when I modify a record which bind to SQLCacheDependy.

I see some errors in log like


Message
The query notification dialog on conversation handle '{8F8CC642-6340-DB11-8F09-0014227B7B80}.' closed due to the following error: '<?xml version="1.0"?><Error xmlns="http://schemas.microsoft.com/SQL/ServiceBroker/Error"><Code>-8490</Code><Description>Cannot find the remote service &apos;SqlQueryNotificationService-f79776f7-9ca5-4c5f-8a66-0d81f7673683&apos; because it does not exist.</Description></Error>'.

Any idea how to find out the problem?

thanks!

View 1 Replies View Related

SQL 2000 Stops To Increment @cpu_busy Value, Sp_monitor Does Not Work Anymore

Apr 29, 2006

1) After a couple of months of work SQL 2000 server stops to increment @@cpu_busy. If you query it you€™ll get a constant value as well as error:

select @@CPU_BUSY

Arithmetic overflow occurred.
134217727

2) If you execute sp_monitor you'll get nothing but errors:

Arithmetic overflow occurred.
Arithmetic overflow occurred.
Arithmetic overflow occurred.

This happens only on multiprocessor machines. SQL Service pack 3. The only way to fix it is to restart the SQL service. If you have a performance tool based on that value, like Idera's SQLdm- sorry, it will show zero.

Is there a fix from MS for that?

View 6 Replies View Related

Right Code Statements Of SqlConnection &&amp; 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

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 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







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