I have got this error below which is similar with what has posted in forum.
SQL_ERROR (-1) in OdbcConnection::connect
sqlstate=28000,
level=-1, state=-1, native_error=18456, msg=[Microsoft][SQL Native
Client][SQL Server]Login failed for user 'sa'.
As i have found its solution in this forum. Here I would like to ask since my Ms SQL server epress set up fail due to the error above, but some of the previous setup is successful. In this case, am I going to run the .exe set up to continue the remaining process or I have to uninstall and install it again?
Thanks.
In one of my packages, I set the package-level property called TransactionOption=Required. During run-time I saw an error saying "[Execute SQL Task] Error: Failed to acquire connection "SQL_DW". Connection may not be configured correctly or you may not have the right permissions on this connection. ". When the property is changed to anything other than Required, it works fine (the calling package that calls this package is not involved in a transaction).
The machine running the packages is Windows Server 2003, and so is the database where the data lives. I verified that the machine containing the database does has Enable Network DTC Access checked in Control Panel -> Add/Remove Windows Components -> Application Server.
I had link my 4 of workstations to server with MySql.1 pc of my pc can run a software which can update MsSql perfectly but notothers(3 failed).I tried to add System Dsn data source for Control Panel - Odbc data source32.The pc which working fine with the software function but 3 of the rest not.My pcs running xp and win98 !Regards.Thanks.Leslie Lim
Hi, I have a web apllication using asp.net, I have two connectionstrings (cadenaCon and cadenaCon2) in web.config. <connectionStrings> <add connectionString="Server=SUNBOGW-MROMEROSQLEXPRESS;Database=ModulosWebkkk;UID=sa;PWD=martha;" name="cadenaCon" providerName="System.Data.SqlClient" /> <add connectionString="Server=SUNBOGW-MROMEROSQLEXPRESS;Database=ModulosWeb;UID=sa;PWD=martha;" name="cadenaCon_bak" providerName="System.Data.SqlClient" /></connectionStrings>In the class file I have this sub and it works well Public Sub New() conexion = New SqlConnection(ConfigurationManager.ConnectionStrings("cadenaCon").ConnectionString.ToString)End Sub My problem is I like to try to connect with cadenaCon and if this connection fails use the other. I used a try but it donĀ“t work, Public Sub New() Try conexion = New SqlConnection(ConfigurationManager.ConnectionStrings("cadenaCon").ConnectionString.ToString) Catch ex As Exception Throw New Exception(ex.Message) conexion = New SqlConnection(ConfigurationManager.ConnectionStrings("cadenaCon_bak").ConnectionString.ToString) Finally End TryEnd Sub Please I aprecitate a sugestion. Thanks Martha
Hi group,being pretty new to setting up sql server, I am stuck. Have installed sql 2000 server on Win 2000 server, IIS 5.0. I try to connect via ASP script that looks like this:<%Set Conn = Server.CreateObject("ADODB.Connection")ConStr = "PROVIDER=SQLOLEDB; DATA SOURCE=192.168.1.99"ConStr = ConStr & ";UID=someUser;PWD=somePassword" ConStr = ConStr & ";initial catalog=myDatabaseName;network library=DBMSSOCN"Conn.Open ConStrConn.CloseSet Conn = Nothing%>The IP number is the webserver my router points to on port 80.But get an HTTP 500 error and "The page cannot be displayed"Any suggestions as to what I am doing wrong here, would be very much appreciated.I have run applications for a long time that operate Access databases, but starting a new, an big project, forces me to upgrade to sql databases.Best wishesFCH
When i attempted to connected to Microsoft SQL Server 2005 Express via ASP.NET 2.0 application, it seems to throw the following error.
I had set up the Protocols for Express (TCP/IP and Named Pipes are both enabled) to allow remote connections using both TCP/IP and named pipes. 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.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
or:
2) Add the following section to the configuration file of your application:
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
I am running SQL Server 2012 on a VM and am trying to pull data from a network drive (S: or misvnascfs0003).I can import data using the Import Wizard and save the package as an SSIS package. When I try to Run the Package I get The Acquire Connection method call to the connection manager "SourceConnectionExcel" failed with the error...
If I save the file to the VM local drive the SSIS package run fine.When I log into SSIS through SSMS i have to run as "Administrator".
We find that if we deploy the OLAP database with a different name on the test server, then regardless of how we change the connection string provided to the SSIS package that processes the cube, then the package fails to connect to the database. To clarify:
In development the OLAP database is called MyOlapDB and the source database is called MySqlDB. Both are on the same machine. When the the application is built and released for test, the test team install the databases on a replica of the production environment (i.e. web app on one machine, OLAP DB on another and SQL database on yet another). They also, quite rightly, implement the new test databases so they incorporate the build version number. So, MyOlapDB123 and MySqlDB123 are both from build 123.
This is when the problems start. Regardless of how the connection string is specified in the job that processes the cube, the SSIS integration package fails with the error:
[Analysis Services Execute DDL Task] Error: Errors in the metadata manager. Either the database with the ID of 'MyOlapDB' does not exist in the server with the ID of 'OurTestServer', or the user does not have permissions to access the object.
We have tried config files and job properties, but neither work. Also, simply attempting to run the package using the DTEXECUI does not work either.
Looking inside the XML of the package, we clearly see the ConnectionManager object which has the original connection string, which is
Data Source=localhost;Initial Catalog=MyOlapDB;Provider=MSOLAP.3;Integrated Security=SSPI;Impersonation Level=Impersonate;
However, editing the initial catalog here still does not solve the problem. Searching the XML for the string MyOlapDB reveals the OLAP database name in two other places - both within the object data of the two Analysis Services Execute DDL tasks.
Anyone know how to solve this problem without having to hack the XML of the package?
Dear experts, I've a database in sql2005 and now I want to build a same one on another machine. I've searched thru google and told that i can use backup& restore or using script. I've tested using backup/restore and it works great now i want to give a test to script. I've script the database successfully to a sql script file, however, when i run it against the new database server, the new database was not created as expected. Could anybody explain why? Thanks in advance
I am trying to attach a database, but get access error. here is what I did:
(1) I installed the microsoft sql server 2005 express and sql server management studio express on my pc (vista).
(2) I imported a database called myCompany.mdf, saved in the Microsoft SQL Server/MSSQL.1/MSSQL/Data directory, all users (including myself mary-PCmary) allowed with full control.
(3) Attach database using microsoft SQL server management studio express -> right click Database -> Attach -> attachDatabase windown pop up -> click Add..-> give me the following error:
TITLE: Microsoft SQL Server Management Studio Express ------------------------------
Failed to retrieve data for this request. (Microsoft.SqlServer.Express.SmoEnum)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)
------------------------------
The server principal "mary-PCmary" is not able to access the database "model" under the current security context. (Microsoft SQL Server, Error: 916)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=916&LinkId=20476
------------------------------ BUTTONS:
OK ------------------------------
I am the admin of this PC and can see the database and log files in the /data directory with full permission, but why can't I attach the databae file to the sql server? can someone help? thanks,
I added a connection (ADO.NET) object by name testCon in the connection manager - I wanted to programmatically supply the connection string. So I used the "Expressions" property of the connection object and set the connectionstring to one DTS variable. The idea is to supply the connection string value to the variable - so that the connection object uses my connection string.
Then I added a "Backup Database Task" to my package with the name BkpTask. Now whenever I try to set the connection property of BkpTask to the testCon connection object, by typing testCon, it automatically gets cleared. I am not able to set the connection value.
Then after spending several hours I found that this is because I have customized the connection string in testCon. If I don't customize the connection string, I am able to enter the "testCon" value in the connection property of the BkpTask.
On my dev server I have working ssis packages that use connections Microsoft OLEDB provider for Oracle MSDAORA.1 and Oracle provider for oledb and OracleClient data provider.
I use one or the other according to my needs.
In anticipation and to prepare for the build of a new production server, I have build a test server from scratch and deployed to it the entire dev.
Almost everything works except Microsoft OLEDB provider for Oracle.
ssis packages on the test machine will return an error
Error at Pull Calendar from One [OLE DB Source [1]]: The AcquireConnection method call to the connection manager "one.oledb" failed with error code 0xC0202009.
Error at Pull Calendar from One [DTS.Pipeline]: component "OLE DB Source" (1) failed validation and returned error code 0xC020801C.
[Connection manager "one.oledb"]: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft OLE DB Provider for Oracle" Hresult: 0x80004005 Description: "Oracle error occurred, but error message could not be retrieved from Oracle.".
I have used the same installers for OS, SQL and Oracle SQL*Net on both dev and test machines. The install and then the restore/deployment on Test went fine.
Does anyone could point me to the right direction to solve this issue?
Hi, I am preparing to upgrade my database to 7.0. While doing DBCC on my existing database (in version 6.5), the process completed with status fail. Below is the message given:
Processed 64 entries in the Sysindexes for dbid 7. Found 7 bad entries in the Sysindexes. DBCC execution completed. If DBCC printed error messages, see your System Administrator.
Should I just ignore this message and proceed? If I were to clean up the bad entries, how do I proceed?
I was installing SQL server 2005 by unattended installation. I've been using this method for a few times before, and they were all successful. However, when I use this method recently, the following message pops up in the middle of the installation (around the time when it is trying to install SQL Server Database service):
SQL Server Setup was unable add user NTADMINNcheng to local group SQLServer2005MSFTEUser$NTHKGV34$NCHENG
and because of this, the whole setup failed.
Could someone please help me on this issue? Thanks in advance.
Every once in a while a scheduled restore of a production database backup to a development server will fail with the following error.
RESTORE cannot operate on database 'XXX' because it is configured for database mirroring or has joined an availability group
While it is true the production database is involved in database mirroring, the development server does not have database mirroring enabled. This error tells me something within the backup is telling the development server the database is configured for database mirroring.
However the perplexing part for me is that we only receive this error maybe 5% of the time, if that, and only on a couple of our databases. We have numerous other restores of mirrored production databases to development servers that have never produced this error. So my question is what is causing this error to occur, and why is it not happening all of the time? We get around this error by deleting the DEV database and re-running the restore job.
I have done a full backup on 3pm, and a differential backup on everyday 5pm.
I try to restore it back in my testing server and i encounter the problem in restoring the File3 and i try to restore the File 2 and it is okie. Can i know wat is the problem usually cause this error? Thank you
I've been running the Ola Hallengren maintenance script for the last five months without missing a beat. Today I find an error stating the UserDatabase Integrity check job failed last night. This is running on SQL Server 2014 BI edition w/64 Gigs.
I ran a DBCC CHECKDB on each database manually and all worked until I tried it on the biggest one that is about 18 gbs. It just keeps running and I eventually stopped it so I'm guessing it is memory, but doesn't make sense considering it has 64 gbs. I have it set to 64/4 max / min. Again, this was never an issue until last night.I've been looking up all morning, but not seeing much on this error "The operating system returned error 1453"?
I need detailed instructions on how to connect to a database from a Microsoft Access 2007 database to a Microsft Office Accounting 2007 database. The accounting database is an SQL 2005 datbase. It has an instance name of "MSSMLBIZ".
When I try I get an SQL error 53. Do not have permissions or database does not exist.
Hi-I have a sql server database, and am wring web apps to access it.I've created databases different ways, and ended up with different owners (eg dbo, nt authorityetwork services...)I also have connection strings using windows authentication, and some using a user name and password.I have read that using windows authentication is the best way to go, as far as security goes, but I have noticed some connectivity issues when I upload the site to the server, and test it remotely. What is the safest 'owner' of the database, and what's the safest way to connect?Thanks Dan
I'm having problems with the code to connect to an SQL DataBase...i'm not experienced with asp.net. I used to work with VB.NET 2003 and SQL Server 2000. Recently i instaled VB.NET 2005 and SQL Server 2005, becouse i couldn't install the earlier VB and SQL (problems with install) so i install the new versions of VB and SQL 2005, but this is like new to me. The problem is that there is new features that i'm not familiarized with...I have this code, a simple code to retrieve data to the webform: ------------------------------------------------------------------------------------------ Imports System.Data.SqlClientPartial Class data-ask Inherits System.Web.UI.Page Private Sub page_load() Dim connection As SqlConnection Dim mycommand As SqlCommand Dim myDataReader As SqlDataReader Dim SQLStmt As String connection = New SqlConnection("Server=matrixWebSite1;uid=sa;pwd=1234;database=aspnet-books;trusted_connection=yes") connection.Open() SQLStmt = "SELECT * FROM books " mycommand = New SqlCommand(SQLStmt, connection) myDataReader = mycommand.ExecuteReader() While myDataReader.Read() Response.Write(myDataReader.Item("books_name") & " - " & myDataReader.Item("book_price") & " Euros<br>") End While connection.Close() End SubEnd Class -------------------------------------------------------------------------------------------What happens is that when i load, the page is blank (no errors is shown) just blank page.I don't know if the connection to database(outside the code) is right (permitions, etc...)Can anyone tell me what is the problem? Thank you....
I am completely new to this so sorry if i am doing something stupid.I have a basic code for connecting to Database but for some reason i get the next error: " System.Data.SqlClient.SqlException: 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 connection could be made because the target machine actively refused it.) " By the way, before this i had an error: 40. i have done many things to fix that but now for some reason those little icons has changed their form, i used to does it mean anything? Here's my connecting code. SqlConnection myConnection = new SqlConnection( "server=localhost; database=master; connection timeout=2; Trusted_Connection=yes;");
try { myConnection.Close(); } catch (Exception ed) { Label1.Text = ed.ToString(); } } log:2007-04-24 18:04:25.34 Server Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Express Edition on Windows NT 5.1 (Build 2600: Service Pack 2)2007-04-24 18:04:25.34 Server (c) 2005 Microsoft Corporation.2007-04-24 18:04:25.34 Server All rights reserved.2007-04-24 18:04:25.34 Server Server process ID is 4176.2007-04-24 18:04:25.34 Server Logging SQL Server messages in file 'c:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLLOGERRORLOG'.2007-04-24 18:04:25.34 Server This instance of SQL Server last reported using a process ID of 7516 at 24/04/2007 18:04:16 (local) 24/04/2007 16:04:16 (UTC). This is an informational message only; no user action is required.2007-04-24 18:04:25.34 Server Registry startup parameters:2007-04-24 18:04:25.34 Server -d c:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDATAmaster.mdf2007-04-24 18:04:25.34 Server -e c:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLLOGERRORLOG2007-04-24 18:04:25.34 Server -l c:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDATAmastlog.ldf2007-04-24 18:04:25.35 Server SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.2007-04-24 18:04:25.35 Server Detected 2 CPUs. This is an informational message; no user action is required.2007-04-24 18:04:25.57 Server Using dynamic lock allocation. Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an informational message only. No user action is required.2007-04-24 18:04:25.59 Server Database Mirroring Transport is disabled in the endpoint configuration.2007-04-24 18:04:25.60 spid5s Starting up database 'master'.2007-04-24 18:04:25.70 spid5s Recovery is writing a checkpoint in database 'master' (1). This is an informational message only. No user action is required.2007-04-24 18:04:25.76 spid5s SQL Trace ID 1 was started by login "sa".2007-04-24 18:04:25.79 spid5s Starting up database 'mssqlsystemresource'.2007-04-24 18:04:26.03 spid5s Server name is 'ALEX-D8997A1AB0SQLEXPRESS'. This is an informational message only. No user action is required.2007-04-24 18:04:26.03 spid8s Starting up database 'model'.2007-04-24 18:04:26.03 spid5s Starting up database 'msdb'.2007-04-24 18:04:26.28 Server A self-generated certificate was successfully loaded for encryption.2007-04-24 18:04:26.34 Server Server is listening on [ 'any' <ipv4> 2936].2007-04-24 18:04:26.34 Server Server local connection provider is ready to accept connection on [ \.pipeSQLLocalSQLEXPRESS ].2007-04-24 18:04:26.34 Server Server named pipe provider is ready to accept connection on [ \.pipeMSSQL$SQLEXPRESSsqlquery ].2007-04-24 18:04:26.34 Server Dedicated administrator connection support was not started because it is not available on this edition of SQL Server. This is an informational message only. No user action is required.2007-04-24 18:04:26.35 Server The SQL Network Interface library could not register the Service Principal Name (SPN) for the SQL Server service. Error: 0x54b. Failure to register an SPN may cause integrated authentication to fall back to NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies.2007-04-24 18:04:26.35 Server SQL Server is now ready for client connections. This is an informational message; no user action is required.2007-04-24 18:04:26.45 spid8s Clearing tempdb database.2007-04-24 18:04:26.78 spid8s Starting up database 'tempdb'.2007-04-24 18:04:26.84 spid5s Recovery is complete. This is an informational message only. No user action is required.2007-04-24 18:04:26.84 spid11s The Service Broker protocol transport is disabled or not configured.2007-04-24 18:04:26.84 spid11s The Database Mirroring protocol transport is disabled or not configured.2007-04-24 18:04:26.87 spid11s Service Broker manager has started.
Hi I have uptil now only used the WYSIWYG for retrieving info from my DB, but now i want to insert some information to the DB in a sub. My connectionstring is in web.config and is as follows <connectionStrings> <add name="shopConnectionString" connectionString="Data Source=IP.ADRESS.GOES.HERE;Initial Catalog=shop;Persist Security Info=True;User ID=MyId;Password=********" providerName="System.Data.SqlClient" /> </connectionStrings> How do i connect to this connectionstring from inside a sub?
I am not able to connect to my database. When I run the following, I get the meassageSystem.Data.SqlClient.SqlException: SQL Server does not exist or access denied.Although SQL SERVER 2000 WINCC is very much running.Trying to solve the problem for days now. Pl help. pcg <%@ Page Language="C#" Debug="true" Trace="true" %><%@ import Namespace="System.Data.SqlClient" %><%@ import Namespace="System.Data" %><script runat="server"> // Insert page code here // void addtosalelist(Object sender, EventArgs e) { Trace.Write("Note - Entered addtosalelist"); string connectionstring= "server=(127.0.0.1);trusted_connection=true;database=LocalHaat.mdf"; SqlConnection dbConnection= new SqlConnection(connectionstring); dbConnection.Open(); Trace.Write("Note - DB connection set up"); Trace.Write("Note - DB connection opened"); //string commandstring = "INSERT INTO Salelist(sellername, email, address,city,category, itemname, itemdescription,price,paymentmode,negotiable,location) " + "Values(@sellername, @email, @address,@city,@category, @itemname, @itemdescription,@price,@paymentmode,@negotiable,@location)"; string commandstring = "INSERT INTO SaleList(SellerName,SellerCity,ItemName) " + "Values(@SellerName,@SellerCity,@ItemName)"; SqlCommand dbcommand= new SqlCommand(commandstring, dbConnection); SqlParameter sname = new SqlParameter("@SellerName", SqlDbType.VarChar, 30); sname.Value = txtname.Text; dbcommand.Parameters.Add(sname); SqlParameter scity = new SqlParameter ("@SellerCity", SqlDbType.VarChar, 15); scity.Value = city.SelectedItem.Value; dbcommand.Parameters.Add(scity); dbcommand.ExecuteNonQuery(); dbConnection.Close(); } </script> Error MessageSQL Server does not exist or access denied. 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: SQL Server does not exist or access denied. Source Error: Line 11: string connectionstring= "server=(127.0.0.1);trusted_connection=true;database=LocalHaat.mdf";Line 12: SqlConnection dbConnection= new SqlConnection(connectionstring);Line 13: dbConnection.Open();Line 14: Trace.Write("Note - DB connection set up");Line 15: Source File: D:Localhaatsell.aspx Line: 13 Stack Trace: [SqlException: SQL Server does not exist or access denied.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +472 System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +311 System.Data.SqlClient.SqlConnection.Open() +383 ASP.sell_aspx.addtosalelist(Object sender, EventArgs e) in D:Localhaatsell.aspx:13 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +83 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1266
--------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573 Request Details Session Id: satdf0jfaoo3tzjd31vxa355 Request Type: POST Time of Request: 08/07/2007 19:08:19 Status Code: 500 Request Encoding: Unicode (UTF-8) Response Encoding: Unicode (UTF-8) Trace Information Category Message From First(s) From Last(s) aspx.page Begin Init aspx.page End Init 0.000044 0.000044 aspx.page Begin LoadViewState 0.000070 0.000026 aspx.page End LoadViewState 0.004889 0.004818 aspx.page Begin ProcessPostData 0.004929 0.000040 aspx.page End ProcessPostData 0.009899 0.004970 aspx.page Begin ProcessPostData Second Try 0.009935 0.000036 aspx.page End ProcessPostData Second Try 0.009972 0.000037 aspx.page Begin Raise ChangedEvents 0.009995 0.000023 aspx.page End Raise ChangedEvents 0.010583 0.000588 aspx.page Begin Raise PostBackEvent 0.010612 0.000029 Note - Entered addtosalelist 0.028321 0.017710 Unhandled Execution Error SQL Server does not exist or access denied. at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() at ASP.sell_aspx.addtosalelist(Object sender, EventArgs e) in D:Localhaatsell.aspx:line 13 at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain()
Hi all, I am new to ASP and having some problems, please help. I am following an example in a book called "Building database driven flash applications". It is to create a flash based front end quiz with ASPx pages and intergrated sql database through ms sql enterprise 2000. I am using Visual Studio 2003. Im a building the administration side which allows update/delete of players and quiz features. The players page uses a data grid, sql connection control and sql command control to connect to the db. This works fine and displays the data. Players.aspx.vbPublic Class ManagePlayers Inherits System.Web.UI.Page#Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer.<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.cnnTriviaGame = New System.Data.SqlClient.SqlConnectionMe.cmdgetplayers = New System.Data.SqlClient.SqlCommand ' 'cnnTriviaGame 'Me.cnnTriviaGame.ConnectionString = "workstation id=LYNDSEYS;packet size=4096;user id=Lyndsey;data source=LYNDSEYS;per" & _ "sist security info=True;initial catalog=Projectdb;password=lyndsey" ' 'cmdgetplayers 'Me.cmdgetplayers.CommandText = "SELECT *, Players.* FROM Players" Me.cmdgetplayers.Connection = Me.cnnTriviaGame End SubProtected WithEvents dgPlayers As System.Web.UI.WebControls.DataGrid Protected WithEvents playersgrid As System.Web.UI.WebControls.DataGridProtected WithEvents cnnTriviaGame As System.Data.SqlClient.SqlConnection Protected WithEvents cmdgetplayers As System.Data.SqlClient.SqlCommand 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it.Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End RegionPrivate Sub Page_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load ' First time the page is loaded (not a form postback) If Not IsPostBack Then ' Create a new SqlDataReader Dim objDR As SqlClient.SqlDataReader ' Open the connection placed on the aspx page cnnTriviaGame.Open() ' Get the data by executing the command on the aspx page objDR = cmdgetplayers.ExecuteReader ' Set the grid data source playersgrid.DataSource = objDR ' Show the data playersgrid.DataBind() End If End SubPrivate Sub dgPlayers_ItemCommand(ByVal source As Object, _ ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) _Handles playersgrid.ItemCommand ' e.Item is the row of the DataGrid where the link was ' clicked. ' Check for what kind of action the user wants to take If LCase(Trim(e.CommandName)) = "Select" Then ' update player Server.Transfer("UpdatePlayer.aspx?idPlayer=" & e.Item.Cells(0).Text) Else ' View the player's answer history Server.Transfer("ViewPlayerHistory.aspx?idPlayer=" & e.Item.Cells(0).Text) End If End Sub For other pages in the application is says not to connect to the db this way but simply create the command and connection control dynamically in the Visual Basic code. When I click a link in the players data grid to go to another page I get an error. This is the same error for all other pages.
Line 35: ' Open the connection Line 36: objConn.ConnectionString = Application("strConn") Line 37: objConn.Open()
the strconn variable is set up in the global.aspx.vb under the application start sub routine. This is the code it asks you to put from the book:Application("strConn") = "data source=YourServer;" & _ "initial catalog=TriviaGame;integrated security=SSPI;" & _ "persist security info=False;workstation id=Server size=4096" The code I have put in:Application("strConn") = "data source=LYNDSEYS;" & _"initial catalog=TriviaGame;integrated security=SSPI;" & _"persist security info=False;workstation id=Server size=4096"
My server is called: LYNDSEYS My database is called:Projectdb My project is called:myproject and the folder where all my pages are is :"TriviaGame" Does anyone have any idea where I am going wrong please. I dont know if it is a simple mistake i am making. Is the initialcatalog where my database name goes or something else? Help please, I hope I have made sense. Lyndsey x
can i have multiple user and password in a connection string ?? for example : <add name="strCon" connectionString="Data Source=test;Initial Catalog=test;User=test, guest;Password=test, guest" providerName="System.Data.SqlClient" />- or is there any other way ?? the reason is that i have created a view that hits 2 database that requires user info and pass ..............any advice is appreciated
Please someone guide me how to make a connection from a different network / outside to the database server at my office. Do I need to configure anything at the server or my local PC? Thanks.
VS2005 i just wonder how can i avoid repeating my connection string. in every form load and control event, i create connection. is there a way that i will only create once and just call it? i tried using method but it didn't work. it's looking for the connection string.. or maybe I'm doing it incorrectly. pls help!
i am when connecting database latter receiveing exception error.Error is : An unhandled exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll
i am when connecting database latter receiveing exception error.Error is : An unhandled exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll
I registered a domain on Internet. I cannot access my Datatbase on my WebSite. [on www.waist7.com] What connection string Shall I write ?
I created my Database with MSSQLmanager on INTERNET on my domain. I added a new TABLE and some data .
I do not know what I should write in "data source=?????" My database is Called "JOB" so i wrote: Dim SQ as new SQLConnection("Data Source=localhost;Initial Catalog=JOB; user=me;password=myPass;") Where did i go wrong ??? [Maybe 'localhost' should be replaced with something else. ?]
Actually I get A RUNTME ERROR SAYING: "Connection cannot be opened....maye because on default settings you cannot access Databases Remotely !"
I think the mistake is in the connectionString. What is the right connection string ??? Where can I find it Displayed ? [in MSSQLmanager]