I have deployed a website on a server having Windows2000, IIS5.0 . It uses SQL Server 2000 which is on another remote server. While developing I used the visual tools in VS.net to make a connection and have used DYnamic properties of the connection object to map the connection string to the entry in to the config file.
This works fine on my developement machine which has IIS and SQL Server 2000 on the same machine.
The entry in the web.config for my connection string is:
value= " server=xxx.yyy.com; Trusted_Connection=yes;provider=SQLOLEDB.1;Initial Catalog=events; User id=myuser; Password=password;"
where xxx.yyy.com is the server running SQL Server2000.
I do not get any error but the conncetion doesnot happen and my datagrid doesnot get filled.
The code for creating the connection is designer generated code.
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.
I have 2 aspx pages. one is "login.aspx" and the second is "test_connection.aspx". the "login.aspx" is using the membership class for my website's security. if u have have restarted your computer and you first load this "login.aspx", this will work fine and you will see that you can create a user. when you load (or view) next "test_connection.aspx" you will get this error message:
System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.
Login failed for user 'sqluser1'.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
If I will restart my computer and I will load first the "test_connection.aspx", this page will work just fine and if you will load next "login.aspx", i will get this error message:
Cannot open user default database. Login failed.
Login failed for user 'YECIAASPNET'.
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: Cannot open user default database. Login failed.
Login failed for user 'YECIAASPNET'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
the page "test_connection.aspx" is using an sql username i have created. I am only using one database in this project and thats it ASPNET.mdf
what's happening? i cant understand. I dont know what im doing wrong. i am very new to this dotNET and MS-SQL. im not sure if this has relation to the other problem i have on the other thread (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=254568&SiteID=1).
i was working on a production server, and have stopped the sqlserver service along with the sql server agent. since i had to copy a MDF file . now i started the service again . but i find that there are no transactions happening ....what could be the reason.
Im facing one problem When more than one user tries to insert record through the application only one users data is getting inserted. Wat might be the problem?
This is the stored proc im using..
create proc [dbo].[GSK_insertregion] (@Country varchar(50),@Userid int,@RegionId varchar(50)) as begin insert into UserHierarchy(Country,Userid,RegionId) values(@Country,@Userid,@RegionId) end
I set up my package for logging to SQL Server. I set up a connection manager for the logging, but did not specify a database. Doesn't that mean that the logging should default to msdb.sysdtslog90?
But when I check the table, there's nothing in it, after I run the package.
Hello people, I don't expect anyone to know the answer to this but I guess we'll see huh?
I'm using Microsoft SQL Server Management Studio to do all my SQL stuff, and one of the tools that comes with this is a program called Microsoft SQL Profiler 2005. Anyways, so I'm using this profiler to capture SQL processes in the background while I work with the front end.
Here is a problem I'm facing... I am looking at this table right... and I see that when I do this certain process on the front end, it inserts 3 rows into the table. So I'm thinking "I know that on the tracer, I should be looking for an insert or a Stored Procedure with and insert in it."
So I use the tracer on the front end process and it shows me all the stored procedures that happen during the process of inserting these 3 rows into this table (btw this process is doing other things besides inserting stuff into this table, but it's what i'm currently working with at the moment.)
So what I do here at my job is I take this code, tweak it to work for our front end, and wah lah.... we're good to go. So in saying that, I make my own stored procedure and I all these stored procedures that are happening.
My result......
I get only 2 row inserts into the table.... the 1st row and the last row..... the middle row isn't inserted for some mysterious reason. I tried checking all the stored procedures for unique information pertaining to that specific row insert but to no avail I couldn't.
So my question to you guys is.... is there anything I'm overlooking that could possibly be inserting that row in the table? Thanks guys!
I have two problems I need some help with.First, I've just inherited a system and am delving into a few timeoutproblems that are causing problems for the users.Now, if I do a simple select * from the table (which looks to be thecause of the problem at this stage) in QA, I get the results back inless than a second. If I open the table in EM it takes about 10. Isthere a difference in viewing the data this way ? I'm used to EM beingvirtually the same speed. There is only one row. Minor questionreally, just something I'd like to understand if there is adifference.CREATE TABLE [QUERY] ([QUERY_ID] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,[CAT_ID] [numeric](18, 0) NOT NULL ,[QUERY_DESCR] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOTNULL ,[USER_NAME] [varchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NOTNULL ,[USER_ID] [int] NOT NULL ,[IND_EURO] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULLCONSTRAINT [DF_QUERY_IND_EURO] DEFAULT ('N'),[IND_DGCOLUMNS] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOTNULL CONSTRAINT [DF_QUERY_IND_DGCOLUMNS] DEFAULT ('N'),[NO_GROUPS] [int] NOT NULL CONSTRAINT [DF_QUERY_NO_GROUPS] DEFAULT(0),[NO_FIELDS] [int] NOT NULL CONSTRAINT [DF_QUERY_NO_FIELDS] DEFAULT(0),[NO_LINES] [int] NOT NULL CONSTRAINT [DF_QUERY_NO_LINES] DEFAULT (0),CONSTRAINT [PK_QUERY] PRIMARY KEY CLUSTERED([QUERY_ID]) WITH FILLFACTOR = 90 ON [PRIMARY] ,CONSTRAINT [FK_QUERY_QUERY_CATEGORY] FOREIGN KEY([CAT_ID]) REFERENCES [QUERY_CATEGORY] ([CAT_ID]) ON DELETE CASCADE ON UPDATE CASCADE) ON [PRIMARY]GOI don't think any re-indexing has been done on this (or the othertables in the db). I was wondering if constant adding/deleting rowscould cause the index to be massive and in need of a good clear out.Any pointers would be appreciated. From what I can tell, there wassome problems trying to get replication to work. I need to dig deeperto see if this is now correct.-------------------------Secondly, there is a another table in the same database.CREATE TABLE [FIELD_DATA] ([ID] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,[DATA_ID] [numeric](18, 0) NOT NULL ,[FIELD_ID] [numeric](18, 0) NULL ,[FIELD_CODE] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOTNULL ,[FIELD_VALUE] [numeric](15, 5) NULL ,CONSTRAINT [PK_FIELDDATA] PRIMARY KEY CLUSTERED([ID]) WITH FILLFACTOR = 90 ON [PRIMARY]) ON [PRIMARY]GOIt holds approx 4 million rows. The rest of the tables have minimaldata and about the same amount (consider them the same if you will).Now, another 'copy' of this database is held elsewhere (differentclient data) and this holds 40 million rows. The difference is thatthe first DB is 4.5GB and the second 6.5GB (approx). Does this provemy theory that re-indexing would be a good idea ?ThanksRyan
"The log file for database is full. Back up the transaction log forthe database to free up some log space."Now I only know this way to deal with that manually,Step1. in option , chance Recovery model from FULL to Simple.Step2: go to task to manually shrink the log fileStep3: Change recovery model back from simple to FULL.But by this way, I could get same problem again, the log file is fill,and need free up.Could you give an idea how to prevent this from happening? what andhow should I do???Thanks a lot in advance for your help.
Iam having 500 pages report,the report ia running for the file key ,I have reference some of the feilds to the reports header segment to display in every page,For every file key the report header feild also will change ,It is working for all file keys but the reference not occuring from body to report header when file key grouping changes to other grouping
Please let me know is there any possible way to do this one
I have configured an alert like below to track all blocked events in SQL Server across all databases and then kick start a sql job when a blocking happens which inserts data to a table, when there is a blocking in SQL server , i get an email  --which is working fine and i am able to track all queries.
but, HOW to get notifications ONLY if BLOCKING IS HAPPENING FOR MORE THAN 30 SECONDS OR 1 MINUTE with out using sp_configure?
---ALERT USE [msdb] GO EXEC msdb.dbo.sp_update_alert @name=N'Blocking Process', @message_id=0, @severity=0, @enabled=1,Â
i am making a query which select the data again a particuler date.
I insert values in the table for with current date(Today's date) and the records is inserted with the date format(2006-07-14 16:12:09),now when i run the query after 2 or 3 minutes to select the records inserted today, my query returns no results.
I think it is because of the the time (14:16 in this case) that after 2 minutes, the query looks for the records inserted at (2006-07-14 18:12 or 2006-07-14 19:12) and does not get the result.
Is there a method to not consider the time(14:16) when running the query but the query fetches the records including the records inserted at this time(14:16) no matter at what time I run the query today?
declare @error int, @rowcount int select @rowcount = COUNT(1) FROM STG_BCDR; while @rowcount > 0 begin  BEGIN TRAN Deletion
[code]....
Above code i try to delete records batch by batch to avoid table locking at BCDR table.total records in this BCDRÂ table is 40,000 records. Â However I run the code at execution plan, the BCDR table still clustered index scan which means that the locking still happend.
If i change the delete top (5000)...... to delete top (5).... then thre is clustered index seek, which is good..The problem here is  each time  only delete top 5 records which is means it will realy take very long time to remove those data.
how to cater the situation inorder for me to delete those huge data without table locking happend. If table locking happend , then other user will not be able to access this table at the same time.
Hi everyone, I use the forms authetification for my report manager and server. But, i have this problem : The Logon page running successfully but redirect to Folder.aspx not happening
To clarify:
>I get the logon page (UILogon.aspx)
>My user has been registered ok (i have checked the entry in the db to make sure it was created)
>I enter the login & password correctly and page posts back
The redirect never happens - In the browser, it never leaves the UILogon.aspx
Using Win2003, SQL Server 2005, Reporting Services
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