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 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
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]
Could someone help me out? I am stuck and I don't have $245.00 to pay for Microsoft Technical phone support. Basically I am trying to establish a connection to my database using C#. When I try to connect I can step into the line of code, but an exception is thrown. Error message in the debugger: ServerVersion = 'myConnection.ServerVersion' threw an exception of type 'System.InvalidOperationException'
C# code: SqlConnection myConnection = new SqlConnection("Data Source=BVCOMPUTER;Initial Catalog=TheMarket;User ID =bill;Password=celebrate4ever"); When the above line of code is executed, then In the IDE debugger when I do a watch on myConnection, there is a tree node labeled "ServerVersion" The following messageis displayed there: Also there appears to be a property of "ServerVersion" named "base".The error message stored there is the following: base {"Invalid operation. The connection is closed."} System.SystemException {System.InvalidOperationException} ---------------------------------------------------- Note that I can drag and drop a grid control on my web form and point to the database I want to connect to. But for some reason when I manually try to connect, I am not able to.
I get a Connections to SQL Server Files (*.mdf) require SQL Server Express 2005 to function properly error when I try to create a new SQL Server .mdf database in Visual Web Developer. I tried to re-install SQL Server express but get a message that it is already installed. I also have SQL Server 2005 installed. Could that be the problem?Any help would be appreciated. Thanks.
Hi 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. Any clues? -svp
All my dreams will come true with this ASP.NET langauge if I only can succesfully connect to my SQL Server 2000 database... I've tried many ways, many parameters...
Can somebody plz gimma the right code to connect a database?
My question is, are the user id and password optional when creating a database connection string? I've created an asp page without including them, but in my aspx page (which is basically supposed to do the exact same thing as the asp page), I'm receiving the following error:
Login failed for user '(null)'. Reason: 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 '(null)'. Reason: Not associated with a trusted SQL Server connection.
Source Error:
Line 48: DisplayConnection = New SqlConnection("Server=infomart;Database=psg") Line 49: DisplayCommand = New SqlCommand("SELECT RollOutID,RequestedDate,Background,Product,StagingPushDate,ProdPushDate FROM rolloutrequests ORDER BY RollOutID DESC", DisplayConnection) Line 50: DisplayConnection.Open() Line 51: DataGrid2.DataSource = DisplayCommand.ExecuteReader() Line 52: DataGrid2.DataBind()
I have a question about data base connections I need to know best practices on how to use them within method. I have a project that is running out of connections to the database and I’m not sure why. so here is a sample of what I’m doing in my database methods. Please point me in the right direction.
Question 1: Now then say I have a method called getBrokerID in a class called brokers, and this method returns a string value. Now then do I need to put the dim cnn as new sqlConnection, and the dim resultSet as sqldatareader above the Try statement? And add the cnn.close(), and resultSet.close in my exception statement? Or will the connection be closed at the end of the End function block without any extra code. Which is what I always thought happened but it seems not to be the case. Cause if I take out all my cnn.Close, and resultSet.close statements I start running out of connections to the connection pool even with the CommandBehavior.closeconnection. So to me it seems like the calling object is leaving that connection open. For example if I had a form that loaded broker data like this do these questions happen?
Public sub Init() Dim broker as new brokers Broker.getBrokerID() ‘Question 1a. if the cnn.close is removed does the connection cnn stay open here? Broker.doSomethingElse() ‘Question 1b. Now a new cnn is created now do I have two connections open to my pool? End sub
Public class Brokers
Public Function GetBrokerID(ByVal Broker As String) As String Try 'check to see if a ' is in the broker string If Broker.IndexOf("'") > 0 Then Broker = Broker.Insert(Broker.IndexOf("'"), "'") End If
Broker = Trim(Broker) Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) Dim sqlSelectCmd As SqlCommand = New SqlCommand("BrokerRecord", cnn) sqlSelectCmd.CommandText = "select SalespersonNumber FROM QueryMaster..ARD_SalespersonMasterfile where name = '" & Broker & "'" cnn.Open() Dim resultSet As SqlDataReader = sqlSelectCmd.ExecuteReader(CommandBehavior.CloseConnection)
Dim brokerID As String
If resultSet.HasRows = True Then resultSet.Read() brokerID = resultSet("SalespersonNumber") Else cnn.Close() resultSet.Close() Throw New Exception("BrokerID was not found for the Broker, function GetBrokerID") End If cnn.Close() resultSet.Close() Return brokerID
Catch ex As Exception Throw ex End Try End Function End class
Question 2. Returning an sqlDataReader. Now then is this a good practice to follow? Because it seems when I do this it really does leave my connection to my connection pool open, and I don’t know how to close the connection from the calling object. Because the commandbehavior.closeconnection does not seem to be closing the connection.
‘calling method for getBrokerList public sub init() dim broker as new broker dim sqlReader as SqlDataReader sqlReader = broker.getBrokerList while sqlreader.read …do something wend end sub
Public Function getBrokerList() As SqlClient.SqlDataReader Dim sql As String Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) Dim sqlSelectCmd As SqlCommand = New SqlCommand("BrokerListing", cnn)
sql = "SELECT BrokerName, BrokerID FROM tbl_CC_Broker where visibleFlag = 'T'" sqlSelectCmd.CommandText = sql
cnn.Open() Dim resultSet As SqlDataReader = sqlSelectCmd.ExecuteReader(CommandBehavior.CloseConnection) Return resultSet End Function
Question 3. would it be better to structure my broker class with a global database connection, and a global resultSet?
I installed MSDE and the sample databases with it. They work fine.
Well I am using the server explorer of visaula studio standard 2002. I can see all the sample databases there and connect to them as well.
1. -------------------------------------------------------------------- Now i created a new database named "testDb" and in a similar fashion i am using windows login thingy.
When i write my connection string in the program now it doesnt work
I've come from the asp world into .NET and I have looked all over the web for the proper way to make a database connection to a MSSQL server and all I have found is samples of connections to Access databases. Can anyone point me in the direction of how to create a db connection for microsoft sql server.thanks
My database stays in a remote site and I have access it through VPN. I would like connect my current Windows based Asp.Net application with this database. What are my options? Can I connect remote database with SqlDataAdaper, will that be slow? Should I sue Web Services to connect database?
i am using .net framework1.1 and ms sql server 2000 while connecting to the database using asp.net it is giving the following error: login failed for the user <My Computer Name>ASP.NET i am using the following connection string m_strConnection = "server=" + Dns.GetHostName()+";uid=sa;pwd=sa";database=master"+";Trusted_Connection=yes;Connect Timeout=30"; the same code is working in other system which is of same configuration but it is not working in my system plz help me in solving this problem thanks in advance
I am having trouble creating a connection to an MS SQL 2000 database located on a server at the hosting company I'm using, with code running from my localhost. It works when the code is executed on the server at my hosting company, but not when it is executed locally, on my computer. Also, I can't connect to the database using Enterprise Manager. The error I get is this:
SQL Server does not exist or access denied
It has worked before, so I don't understand why it doesn't anymore. It's not a firewall issue, since I have tried to connect with my firewall disabled as well.
hi i m making a win application for which i have used sql server 2005 .i faced a very big problem that i have made the database but i cannot able to connect the database with winn application .for this purpose i ned coding.so please help me.i need your help urgent.