Showing posts with label access. Show all posts
Showing posts with label access. Show all posts

Sunday, March 25, 2012

Connnecting to an MS Access DB with an MS SQL 2000 Stored Proc

I would like to access a table in MS Access from a stored procedure on MS
SQL 2000. The MS Access DB is running on a diferent computer attached on the
same network. I think I need to create an ODBC connection from the MS SQL
2000 to the MS Access DB but not sure. Secondly how do I refer to the table
in the MS SQL stored proc?

Thanks for your input,

Joe SeamourYou need to add a linked server, and then you can query the Access database
directly. The BOL entry for sp_addlinkedserver shows an example, and the
topic "OLE DB Provider for Jet" has more details.

I've never set this up to use an Access DB on a different server myself, but
I think it should work if the MSSQL service account has permission to access
the share where the .mdb file is.

When the linked server is configured, you can query it like this.

SELECT * FROM MyLinkedServer...Table

Simon

"Joe Seamour" <jseamour@.attbi.com> wrote in message
news:1MYKa.33514$Bg.16441@.rwcrnsc54...
> I would like to access a table in MS Access from a stored procedure on MS
> SQL 2000. The MS Access DB is running on a diferent computer attached on
the
> same network. I think I need to create an ODBC connection from the MS SQL
> 2000 to the MS Access DB but not sure. Secondly how do I refer to the
table
> in the MS SQL stored proc?
> Thanks for your input,
> Joe Seamour

Thursday, March 22, 2012

Connectivity from MS Access to Oracle

This probably isn't the right forum but here goes:
I have a user that is trying to connect from MS Access to Oracle. We can co
nnect and see the Oracle data in MS Access but I can't modify it. Supposedl
y that had it working on a different machine that has been replaced but we c
an't get it to work now. W
e've tried using Microsoft ODBC for Oracle v. 2.575.1022.00 and two or three
different versions of Oracle for ODBC, but they all get the same results.
We've even tried connecting to Oracle as the table owner - still read-only a
ccess.
Any help would be greatly appreciated. If I should be posting this to a dif
ferent newsgroup, please let me know which one / where!
Thanks,
Mike Stuart
mstuart_nospam@.gates.comMake sure you specify a primary key or unique identifier
when you link the tables.
You may want to post this in the following newsgroup:
microsoft.public.access.odbcclientsvr
-Sue
On Tue, 9 Mar 2004 12:41:09 -0800, "mikron2"
<anonymous@.discussions.microsoft.com> wrote:

>This probably isn't the right forum but here goes:
>I have a user that is trying to connect from MS Access to Oracle. We can connect a
nd see the Oracle data in MS Access but I can't modify it. Supposedly that had it w
orking on a different machine that has been replaced but we can't get it to work now
.
We've tried using Microsoft ODBC for Oracle v. 2.575.1022.00 and two or three different ver
sions of Oracle for ODBC, but they all get the same results. We've even tried connecting t
o Oracle as the table owner - still read-only access.
>Any help would be greatly appreciated. If I should be posting this to a di
fferent newsgroup, please let me know which one / where!
>Thanks,
>Mike Stuart
>mstuart_nospam@.gates.com|||Dear Sue,
I'm using the SQLconfigdatasource to create a DSN for Oracle and the functio
n doesn't work with Windows XP.
If I remove the old DSn and runs the code, the DSN is created but the connec
tion to the Oracle tables fail. I have realized that if I create the DSN, st
op the code running, open the windows control panel and open and close the c
onfiguration of DSN the con
nection to the tables works fine.
I think that after the SQLconfigdatasource the DSN is created but lack somet
hing ( maybe an update of the WIN register) to work properly. This case does
nt happen in WIN 2000.
Can you help me? If you can answer me in my email : mauricio.farto@.itelefoni
ca.com.br
Thanks in advance.

Connectivity from Client to Server

Hai,

I am often getting the message

"SQL Server does not exist or access denied (Connection Open (Connect())"

when connecting from the client sql 2000 to the server and at sometimes it gets connected and it still exists/persists for some time.

though i checked the user rights, client server network utility where tcp/ip is the first protocol.

Give a (me) way to connect to the server, though the user iam trying to connect works in the Query Analyser in the Server

here,
vijayanand.gI know this a post from a previous post. I would try sql profiler and monitor the connections to see if the server is rejecting you or are you not getting there at all. You can use vnc or terminal services to connect to the server (for a good connection) and monitor your connection status.

Let me know.|||Hai,

Though i connect from the profiler the Server gives an error


here,
vijayanand.g|||Is the server behind any firewall?
Originally posted by g_vijayanand
Hai,

Though i connect from the profiler the Server gives an error


here,
vijayanand.g|||You need to execute the profiler either on the sql server or through a remote connection (using vnc or terminal services). Then try to connect on your machine and see what the profiler shows.|||Sorry - I just received your emails - I only have access to my email at home. Basically, you will need to find a machine that has access to the sql server (or login to the actual sql server) and run the profiler and see if at least the server sees that you are attempting to hit it.|||Hai,

The profiler does not connect and trace the required samples.

here,
vijayanand.g|||Hai,

I tried to connect from other machine in sql enterprise manager and query analyser for the specified user, it connects - but through my login in the domain it does not connect.

For the past 1 week iam trying to connect from a XP Machine , it does not connect, i tried to connect from a Windows 98 machine it connects, from a machine that has been logged as an administrator it connects, now i've changed my machines OS to Windows NT Server - now also not connecting .

here,
vijayanand.g|||Hai,

Connected to the Server. It was due to the entry that did not exist for the specified machine in the Hosts file or LmHosts file for the specified machine name.

The connectivity came when the connection was tested with the server by registering the Client by giving the ip address of the machine.

here,
vijayanand.g

Connectionstring W/O password

I have an asp.net 1.1 application that has to access a SQL Server DB on
another server. In the past we have simply put UID and PWD in the
connectionstring and everything works well.
We now have a client that insists we not include pwd in the connection
string. Although this is easy to do when the DB is on the same server,
using NT Authority, I don't know how to do it when the db is on another
server.
Someone told me to "set up identical service accounts" but I don't know what
that means. I know it's easy to encrypt a connection string in 2.0 but this
is a 1.1 app.
Can someone tell me how this is best done?
Thanks,
TTina
Are both servers in the same domain?
"Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
news:OhAc%23u0NIHA.2140@.TK2MSFTNGP03.phx.gbl...
>I have an asp.net 1.1 application that has to access a SQL Server DB on
>another server. In the past we have simply put UID and PWD in the
>connectionstring and everything works well.
> We now have a client that insists we not include pwd in the connection
> string. Although this is easy to do when the DB is on the same server,
> using NT Authority, I don't know how to do it when the db is on another
> server.
> Someone told me to "set up identical service accounts" but I don't know
> what that means. I know it's easy to encrypt a connection string in 2.0
> but this is a 1.1 app.
> Can someone tell me how this is best done?
> Thanks,
> T
>|||I already answered this question below. If you open different topics then we
can not reach to the happy end.
If you are in a domain then you'll not need to create identical accounts on
both servers, it would be enough to create a Login in your SQL Server
Instance for the account you want to log in to your SQL Server and use this
domain account for your ASP app in its conn str.
If those servers are not in the same domain but in the same network then try
my suggestion which is under your previous topic.
Ekrem nsoy
"Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
news:OhAc%23u0NIHA.2140@.TK2MSFTNGP03.phx.gbl...
>I have an asp.net 1.1 application that has to access a SQL Server DB on
>another server. In the past we have simply put UID and PWD in the
>connectionstring and everything works well.
> We now have a client that insists we not include pwd in the connection
> string. Although this is easy to do when the DB is on the same server,
> using NT Authority, I don't know how to do it when the db is on another
> server.
> Someone told me to "set up identical service accounts" but I don't know
> what that means. I know it's easy to encrypt a connection string in 2.0
> but this is a 1.1 app.
> Can someone tell me how this is best done?
> Thanks,
> T
>|||no. they are in different workgroups. Why do you ask? I could probably put
them in a domain system and in the same domain.
T
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uiGWf60NIHA.6060@.TK2MSFTNGP05.phx.gbl...
> Tina
> Are both servers in the same domain?
> "Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
> news:OhAc%23u0NIHA.2140@.TK2MSFTNGP03.phx.gbl...
>|||If they are , this login should exist in Active Directory and to be seen
from both machine
You can create a login let me say ASP_USER (on both machine) to access
both machines.
"Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
news:uTzaEX1NIHA.4832@.TK2MSFTNGP04.phx.gbl...
> no. they are in different workgroups. Why do you ask? I could probably
> put them in a domain system and in the same domain.
> T
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:uiGWf60NIHA.6060@.TK2MSFTNGP05.phx.gbl...
>|||They don't use active directory
T
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uoYZ8b1NIHA.3852@.TK2MSFTNGP06.phx.gbl...
> If they are , this login should exist in Active Directory and to be
> seen from both machine
> You can create a login let me say ASP_USER (on both machine) to access
> both machines.
> "Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
> news:uTzaEX1NIHA.4832@.TK2MSFTNGP04.phx.gbl...
>

Connectionstring W/O password

I have an asp.net 1.1 application that has to access a SQL Server DB on
another server. In the past we have simply put UID and PWD in the
connectionstring and everything works well.
We now have a client that insists we not include pwd in the connection
string. Although this is easy to do when the DB is on the same server,
using NT Authority, I don't know how to do it when the db is on another
server.
Someone told me to "set up identical service accounts" but I don't know what
that means. I know it's easy to encrypt a connection string in 2.0 but this
is a 1.1 app.
Can someone tell me how this is best done?
Thanks,
TTina
Are both servers in the same domain?
"Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
news:OhAc%23u0NIHA.2140@.TK2MSFTNGP03.phx.gbl...
>I have an asp.net 1.1 application that has to access a SQL Server DB on
>another server. In the past we have simply put UID and PWD in the
>connectionstring and everything works well.
> We now have a client that insists we not include pwd in the connection
> string. Although this is easy to do when the DB is on the same server,
> using NT Authority, I don't know how to do it when the db is on another
> server.
> Someone told me to "set up identical service accounts" but I don't know
> what that means. I know it's easy to encrypt a connection string in 2.0
> but this is a 1.1 app.
> Can someone tell me how this is best done?
> Thanks,
> T
>|||I already answered this question below. If you open different topics then we
can not reach to the happy end.
If you are in a domain then you'll not need to create identical accounts on
both servers, it would be enough to create a Login in your SQL Server
Instance for the account you want to log in to your SQL Server and use this
domain account for your ASP app in its conn str.
If those servers are not in the same domain but in the same network then try
my suggestion which is under your previous topic.
--
Ekrem Önsoy
"Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
news:OhAc%23u0NIHA.2140@.TK2MSFTNGP03.phx.gbl...
>I have an asp.net 1.1 application that has to access a SQL Server DB on
>another server. In the past we have simply put UID and PWD in the
>connectionstring and everything works well.
> We now have a client that insists we not include pwd in the connection
> string. Although this is easy to do when the DB is on the same server,
> using NT Authority, I don't know how to do it when the db is on another
> server.
> Someone told me to "set up identical service accounts" but I don't know
> what that means. I know it's easy to encrypt a connection string in 2.0
> but this is a 1.1 app.
> Can someone tell me how this is best done?
> Thanks,
> T
>|||no. they are in different workgroups. Why do you ask? I could probably put
them in a domain system and in the same domain.
T
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uiGWf60NIHA.6060@.TK2MSFTNGP05.phx.gbl...
> Tina
> Are both servers in the same domain?
> "Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
> news:OhAc%23u0NIHA.2140@.TK2MSFTNGP03.phx.gbl...
>>I have an asp.net 1.1 application that has to access a SQL Server DB on
>>another server. In the past we have simply put UID and PWD in the
>>connectionstring and everything works well.
>> We now have a client that insists we not include pwd in the connection
>> string. Although this is easy to do when the DB is on the same server,
>> using NT Authority, I don't know how to do it when the db is on another
>> server.
>> Someone told me to "set up identical service accounts" but I don't know
>> what that means. I know it's easy to encrypt a connection string in 2.0
>> but this is a 1.1 app.
>> Can someone tell me how this is best done?
>> Thanks,
>> T
>|||If they are , this login should exist in Active Directory and to be seen
from both machine
You can create a login let me say ASP_USER (on both machine) to access
both machines.
"Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
news:uTzaEX1NIHA.4832@.TK2MSFTNGP04.phx.gbl...
> no. they are in different workgroups. Why do you ask? I could probably
> put them in a domain system and in the same domain.
> T
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:uiGWf60NIHA.6060@.TK2MSFTNGP05.phx.gbl...
>> Tina
>> Are both servers in the same domain?
>> "Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
>> news:OhAc%23u0NIHA.2140@.TK2MSFTNGP03.phx.gbl...
>>I have an asp.net 1.1 application that has to access a SQL Server DB on
>>another server. In the past we have simply put UID and PWD in the
>>connectionstring and everything works well.
>> We now have a client that insists we not include pwd in the connection
>> string. Although this is easy to do when the DB is on the same server,
>> using NT Authority, I don't know how to do it when the db is on another
>> server.
>> Someone told me to "set up identical service accounts" but I don't know
>> what that means. I know it's easy to encrypt a connection string in 2.0
>> but this is a 1.1 app.
>> Can someone tell me how this is best done?
>> Thanks,
>> T
>>
>|||They don't use active directory
T
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uoYZ8b1NIHA.3852@.TK2MSFTNGP06.phx.gbl...
> If they are , this login should exist in Active Directory and to be
> seen from both machine
> You can create a login let me say ASP_USER (on both machine) to access
> both machines.
> "Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
> news:uTzaEX1NIHA.4832@.TK2MSFTNGP04.phx.gbl...
>> no. they are in different workgroups. Why do you ask? I could probably
>> put them in a domain system and in the same domain.
>> T
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:uiGWf60NIHA.6060@.TK2MSFTNGP05.phx.gbl...
>> Tina
>> Are both servers in the same domain?
>> "Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
>> news:OhAc%23u0NIHA.2140@.TK2MSFTNGP03.phx.gbl...
>>I have an asp.net 1.1 application that has to access a SQL Server DB on
>>another server. In the past we have simply put UID and PWD in the
>>connectionstring and everything works well.
>> We now have a client that insists we not include pwd in the connection
>> string. Although this is easy to do when the DB is on the same server,
>> using NT Authority, I don't know how to do it when the db is on another
>> server.
>> Someone told me to "set up identical service accounts" but I don't know
>> what that means. I know it's easy to encrypt a connection string in
>> 2.0 but this is a 1.1 app.
>> Can someone tell me how this is best done?
>> Thanks,
>> T
>>
>>
>

Connectionstring W/O password

I have an asp.net 1.1 application that has to access a SQL Server DB on
another server. In the past we have simply put UID and PWD in the
connectionstring and everything works well.
We now have a client that insists we not include pwd in the connection
string. Although this is easy to do when the DB is on the same server,
using NT Authority, I don't know how to do it when the db is on another
server.
Someone told me to "set up identical service accounts" but I don't know what
that means. I know it's easy to encrypt a connection string in 2.0 but this
is a 1.1 app.
Can someone tell me how this is best done?
Thanks,
T
Tina
Are both servers in the same domain?
"Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
news:OhAc%23u0NIHA.2140@.TK2MSFTNGP03.phx.gbl...
>I have an asp.net 1.1 application that has to access a SQL Server DB on
>another server. In the past we have simply put UID and PWD in the
>connectionstring and everything works well.
> We now have a client that insists we not include pwd in the connection
> string. Although this is easy to do when the DB is on the same server,
> using NT Authority, I don't know how to do it when the db is on another
> server.
> Someone told me to "set up identical service accounts" but I don't know
> what that means. I know it's easy to encrypt a connection string in 2.0
> but this is a 1.1 app.
> Can someone tell me how this is best done?
> Thanks,
> T
>
|||I already answered this question below. If you open different topics then we
can not reach to the happy end.
If you are in a domain then you'll not need to create identical accounts on
both servers, it would be enough to create a Login in your SQL Server
Instance for the account you want to log in to your SQL Server and use this
domain account for your ASP app in its conn str.
If those servers are not in the same domain but in the same network then try
my suggestion which is under your previous topic.
Ekrem nsoy
"Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
news:OhAc%23u0NIHA.2140@.TK2MSFTNGP03.phx.gbl...
>I have an asp.net 1.1 application that has to access a SQL Server DB on
>another server. In the past we have simply put UID and PWD in the
>connectionstring and everything works well.
> We now have a client that insists we not include pwd in the connection
> string. Although this is easy to do when the DB is on the same server,
> using NT Authority, I don't know how to do it when the db is on another
> server.
> Someone told me to "set up identical service accounts" but I don't know
> what that means. I know it's easy to encrypt a connection string in 2.0
> but this is a 1.1 app.
> Can someone tell me how this is best done?
> Thanks,
> T
>
|||no. they are in different workgroups. Why do you ask? I could probably put
them in a domain system and in the same domain.
T
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uiGWf60NIHA.6060@.TK2MSFTNGP05.phx.gbl...
> Tina
> Are both servers in the same domain?
> "Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
> news:OhAc%23u0NIHA.2140@.TK2MSFTNGP03.phx.gbl...
>
|||If they are , this login should exist in Active Directory and to be seen
from both machine
You can create a login let me say ASP_USER (on both machine) to access
both machines.
"Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
news:uTzaEX1NIHA.4832@.TK2MSFTNGP04.phx.gbl...
> no. they are in different workgroups. Why do you ask? I could probably
> put them in a domain system and in the same domain.
> T
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:uiGWf60NIHA.6060@.TK2MSFTNGP05.phx.gbl...
>
|||They don't use active directory
T
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uoYZ8b1NIHA.3852@.TK2MSFTNGP06.phx.gbl...
> If they are , this login should exist in Active Directory and to be
> seen from both machine
> You can create a login let me say ASP_USER (on both machine) to access
> both machines.
> "Tina" <TinaMSeaburn@.nospamexcite.com> wrote in message
> news:uTzaEX1NIHA.4832@.TK2MSFTNGP04.phx.gbl...
>

ConnectionString property has not been initialized

My IT dept set up an SQL db on a server for me and I am connected to it through a port. They told me I had to create my tables through an MS Access adp, which I have done. I am using VWD Express and am trying to create a login page using usernames and pw's from a db table. I am connected (at least the db Explorer tab shows I am) to the MS Access adp and can drop a GridView from my Employees table from it onto a page and get results. I keep getting the "ConnectionString property not initialized" error message pointing to my sqlConn.Open() statement and cannot figure out why. I have looked at hundreds of posts but can't seem to find anything that works. If someone could point me to some post or website that could explain connecting to a SQL db through a port or whatever you think I need to learn to get this fixed I would appreciate it.
Web config:

<configurationxmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<appSettings/>

<connectionStrings>

<addname="ASPNETDB"connectionString="Description=Training;DRIVER=SQL Server;SERVER=USAWVAS27;UID=usx14611;APP=Microsoft? Visual Studio? 2005;WSID=983QD21;Network=DBMSSOCN;Address=USAWVAS27,3180;Trusted_Connection=Yes"providerName="System.Data.Odbc"/>

</connectionStrings>

<system.web>

<authenticationmode="Forms" />

<authorization>

<denyusers="?" />

</authorization>

<customErrorsmode="Off" />

</system.web>

</configuration>
My login.aspx page

<%@.PageLanguage="VB"debug="true"%>

<%@.ImportNamespace="System.Data.SqlClient" %>

<%@.ImportNamespace="System.Configuration.ConfigurationManager" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<scriptrunat="server">

ProtectedSub LoginUser(ByVal sAsObject,ByVal eAs EventArgs)

Dim blnAuthenticateAsBoolean = Authenticate(username.Text, password.Text)

If blnAuthenticateThen

FormsAuthentication.RedirectFromLoginPage(username.Text,False)

EndIf

EndSub

Function Authenticate(ByVal strUsernameAsString,ByVal strPasswordAsString)AsBoolean

Dim strConnectionAsString = ConfigurationManager.AppSettings("ASPNETDB")

Tried this code as well
Dim sqlConn As New SqlConnection(ConfigurationManager.AppSettings("ASPNETDB"))

Dim sqlConnAsNew SqlConnection(strConnection)

Dim sqlCmdAs SqlCommand

Dim sqlDRAs SqlDataReader

Dim userFoundAsBoolean

sqlCmd =New SqlCommand("SELECT * FROM Employees " & _

"WHERE username='" & strUsername &" ' AND password='" & strPassword &"'", sqlConn)

sqlConn.Open()

sqlDR = sqlCmd.ExecuteReader()

userFound = sqlDR.Read()

sqlDR.Close()

Return userFound

EndFunction

</script>

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

<div>

<p>Username:<asp:TextBoxID="username"runat="server"></asp:TextBox><br/>

<br/>

<p>Password:<asp:TextBoxID="password"runat="server"></asp:TextBox><br/>


<br/>

<asp:ButtonID="btnSubmit"runat="server"Text="Login"OnClick="LoginUser"/> </div>

</form>

</body>

</html>
Thanks

Still trying to figure this out. I can't believe that there isn't some resource(book, website..) out their that explains these types of errors. My IT dept insists that the database was set up correctly to allow me to use a table with usernames and pw's to build a login page but no matter what I try I get the same message. There doesn't seem to be any reason whatsoever for it to not work. I'm not even getting errors when I debug, just when I enter a login/password onto my login.aspx page and submit.
I removed my database connection and reconnected which gave me this as a new connection string:

<connectionStrings>

<addname="connString"connectionString="Data Source=USAWVAS27;Initial Catalog=MaterialsTraining;Integrated Security=False"/>

</connectionStrings>
Anybody have any ideas?
Thanks,
Toni

|||I haven't done this in VB, but here's what I think it should be based on how C# does it.
Looks like this:

Dim strConnectionAsString = ConfigurationManager.AppSettings("ASPNETDB")

Should be this:

Dim strConnectionAsString = ConfigurationManager.ConnectionStrings("ASPNETDB").ConnectionString

|||

Finally got this figured out so thought I'd share it. Thanks to those who responded with suggestions. It didn't like "DRIVER" and "Description" in my original system generated connection string, I'm assuming because it is an SQL database (?)
<connectionStrings>

<addname="ASPNETDB"connectionString="DataSource=Training;server=USAWVAS27;wsid=983QD21;network=DBMSSOCN;address=USAWVAS27,3180;trusted_connection=Yes"/>

</connectionStrings>

|||Hello, am getting a similar problem to the one you had. But I stilldon't know how to fix it. I only get the error when am runnign thelogin.It says the conn is not initialized. It's been giving me aheadache for 2 days now. Please help if possible
Protected Sub loginBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles loginBtn.Click
Dim strConnection As String = ConfigurationManager.AppSettings("sups")
Dim conn As New SqlConnection(strConnection)
Dim cmd As SqlCommand
Dim read As SqlDataReader
conn.Open()
The web.config file is like this...
<configuration>
<appSettings/>
<connectionStrings>
<add name="sups"connectionString="server=localhost;Trusted_Connection=true;database=sups;uid=abcd; pwd=abcd;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
Where am I going wrong? Thanks a lot
|||I fixed this error with this if anyone is having problems

Dim sSQL As String
sSQL = "SELECT * FROM optionitems WHERE id=" & ID.ToString


Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("cre8StoreConnectionString").ConnectionString)
Dim cmd As New SqlCommand(sSQL)
conn.Open()
cmd.Connection = conn

Dim reader As SqlDataReader = cmd.ExecuteReader

the problem I was having to genrate this error was caused because I was using the datareader without assigning a connection to the SQLcommand object.

Tuesday, March 20, 2012

Connections are flaky

Got a sql server 2000 unlimited user license running on a Dell Server (1
CPU). There are several automated programs running 24 -7 that need to access
the database, each running on its own PC. Problem is the programs will run
flawlessly for days and hours, connecting, doing their stuff, closing the
connections (they are in VB6 or VB.NET). They all use the same connection
strings and work with ADO OLEDB connections.
Then all of a sudden on on or the other machine a program that needs to
connect to the server will refuse to connect, with a valid connection string
(we trap it, its OK). The typical error we get back will be server not
found, but if we ping the server either by its name or by IP address on the
computer that is giving us the error, we get a ping response back OK.
We're looking at a possible hardware failure but then we can use the SQL
database OK from within Enterprise Mgr, no problem.
It does not make any sense. Has anyone come accross a similar situation,
what can we do to make this more reliable?
Any help greatly appreciated, we're at our wits end.
BobDoes it ever resolve itself, or once the connection is broken, it cannot
reconnect without restarting the program?!?
Could it be a DNS issue? Could it be that some of the VB6 applications are
not returning all of their resources properly?
I just throwing some ideas out there.
Rick Sawtell
MCT, MCSD, MCDBA
"RD" <nospam@.nospam.net> wrote in message
news:%23oouP$IsEHA.1816@.TK2MSFTNGP15.phx.gbl...
> Got a sql server 2000 unlimited user license running on a Dell Server (1
> CPU). There are several automated programs running 24 -7 that need to
access
> the database, each running on its own PC. Problem is the programs will run
> flawlessly for days and hours, connecting, doing their stuff, closing the
> connections (they are in VB6 or VB.NET). They all use the same connection
> strings and work with ADO OLEDB connections.
> Then all of a sudden on on or the other machine a program that needs to
> connect to the server will refuse to connect, with a valid connection
string
> (we trap it, its OK). The typical error we get back will be server not
> found, but if we ping the server either by its name or by IP address on
the
> computer that is giving us the error, we get a ping response back OK.
> We're looking at a possible hardware failure but then we can use the SQL
> database OK from within Enterprise Mgr, no problem.
> It does not make any sense. Has anyone come accross a similar situation,
> what can we do to make this more reliable?
> Any help greatly appreciated, we're at our wits end.
> Bob
>

Sunday, March 11, 2012

Connection to Sql-Server

Hi,

I'm a newbie at the asp.net site.
The things i have done where with access.
But now i want to use Sql-server

In access i used this to execute a query:

*** In the global.asax ***
session("dbpath") = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=" + Server.MapPath("\db\MediaProject.mdb")

*** Return dataSet ***
ResultDS = GetSql(SqlStatement, session("dbpath"))
Dim ResultDS AS system.data.dataset

*** Lib file: ***
Function GetSQL(a As string, b as string) As System.Data.DataSet
Dim connectionString As String = b
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)
Dim queryString As String = a
Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

The question now is wich string do i now have to put in the session("dbpath") ?
Which is the Provider?
How does the string looks like.
Or do i use something else now ?

Many thanx in advance


oSQLConn.ConnectionString = "Data Source=xxx.xxx.xxx.xxx,1433;" & _
"Initial Catalog=mySQLServerDBName;" & _
"User ID=myUsername;" & _
"Password=myPassword"

Connection to SQLserver

We have a server running SQL2000 which I am trying to get access to via the
internet. I have used the port forwarding setup on our router/firewall to
transfer all traffic on port 1433 to the server 192.168.0.99. I cannot get a
connection as it states the server was not found or it was denied access.
I have a similar method of access to a couple of Personal Addition setups
off site and I can get a connection.
What is slightly unusual is that I have two connections to the internet one
leased line where I can't get access to the firewall and a broadband where I
do. Both are running NAT. Is this an area to check
Thanks for a pointers you can give me
Ian
"Ian Rudge" <Ian.Rudge@.shaw.co.uk> wrote in message
news:Opx2sOvmEHA.556@.tk2msftngp13.phx.gbl...
> We have a server running SQL2000 which I am trying to get access to via
the
> internet. I have used the port forwarding setup on our router/firewall to
> transfer all traffic on port 1433 to the server 192.168.0.99. I cannot get
a
> connection as it states the server was not found or it was denied access.
> I have a similar method of access to a couple of Personal Addition setups
> off site and I can get a connection.
> What is slightly unusual is that I have two connections to the internet
one
> leased line where I can't get access to the firewall and a broadband where
I
> do. Both are running NAT. Is this an area to check
Maybe. There are a lot of variables in getting this to work properly. Check
this article along with links for troubleshooting this setup
http://support.microsoft.com/default...b;en-us;287932
BTW, I hope that was only a fictitious external IP address for your
server...
Steve
|||Thank you for pointers and I will start my search from that.
The IP address is fictional but as it is internal in the 192.168... range I
thought you couldn't get to it or should I panic?
Thx
Ian
"Steve Thompson" <stevethompson@.nomail.please> wrote in message
news:OGpa1X0mEHA.3876@.TK2MSFTNGP15.phx.gbl...
> "Ian Rudge" <Ian.Rudge@.shaw.co.uk> wrote in message
> news:Opx2sOvmEHA.556@.tk2msftngp13.phx.gbl...
> the
> a
> one
> I
> Maybe. There are a lot of variables in getting this to work properly.
> Check
> this article along with links for troubleshooting this setup
> http://support.microsoft.com/default...b;en-us;287932
> BTW, I hope that was only a fictitious external IP address for your
> server...
> Steve
>
|||You're right, I should have recognized that range ;) No need to panic, it
goes without saying that you need a good firewall and isolation from the
"outside".
Steve
"Ian Rudge" <Ian.Rudge@.shaw.co.uk> wrote in message
news:%23rcxs97mEHA.3628@.TK2MSFTNGP09.phx.gbl...
> Thank you for pointers and I will start my search from that.
> The IP address is fictional but as it is internal in the 192.168... range
I[vbcol=seagreen]
> thought you couldn't get to it or should I panic?
> Thx
> Ian
> "Steve Thompson" <stevethompson@.nomail.please> wrote in message
> news:OGpa1X0mEHA.3876@.TK2MSFTNGP15.phx.gbl...
to[vbcol=seagreen]
access.[vbcol=seagreen]
setups
>
|||I think I have found my answer. If I want to connect from outside, the
gateway for the SQLServer machine must point to the Broadband router not the
leased line one
Thx
for the help
"Steve Thompson" <stevethompson@.nomail.please> wrote in message
news:OEGQIECnEHA.1236@.TK2MSFTNGP09.phx.gbl...
> You're right, I should have recognized that range ;) No need to panic, it
> goes without saying that you need a good firewall and isolation from the
> "outside".
> Steve
> "Ian Rudge" <Ian.Rudge@.shaw.co.uk> wrote in message
> news:%23rcxs97mEHA.3628@.TK2MSFTNGP09.phx.gbl...
> I
> to
> access.
> setups
>

Thursday, March 8, 2012

connection to sql server 2000 from Solaris

Does anyone know of any shareware tools available to allow
isql/bcp-like access to sql server 2000 from Sun Solaris ?[posted and mailed, please reply in news]

Steve Chiang (schiang@.refco.com) writes:
> Does anyone know of any shareware tools available to allow
> isql/bcp-like access to sql server 2000 from Sun Solaris ?

You can look at http://www.sommarskog.se/mssqlperl/unix.html and
pursue the links to see if you find anything. No guarantees, though.
Maybe the Free TDS folks have something.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Wednesday, March 7, 2012

Connection timeout/ODBC failed

Dear All,
I am working on a VBA (MS Access) application, which connects Remote
SQL Server by ODBC Connection. When I open this application on my
workstation the error "Connection timeout' or "ODBC - failed"
will occur, But when I open it on the remote desktop it will run.
Can you suggest me what is going wrong.
Regards,
ShitalPerhaps you are blocked by port or by IP address. Typically, SQL Server
inside a network is not exposed to the outside world directly unless it
needs to be.
Can you connect to the remote SQL Server using Enterprise Manager or Query
Analyzer?
"rock" <khandar@.gmail.com> wrote in message
news:1150108297.418689.286870@.y43g2000cwc.googlegroups.com...
> Dear All,
> I am working on a VBA (MS Access) application, which connects Remote
> SQL Server by ODBC Connection. When I open this application on my
> workstation the error "Connection timeout' or "ODBC - failed"
> will occur, But when I open it on the remote desktop it will run.
> Can you suggest me what is going wrong.
> Regards,
> Shital
>

connection timeout exception dialog

Hi,
When I am trying to open Access 2003 report after SQL server is stopped I
am getting following error:
Microsoft SQL Server Login
Connection failed:
SQL Server Error: 53
SQL Server does not exist or access denied.
Our requirement is to supress this error dialog and instead show customized
msg.
Any pointer how to supress error dialog in SQL msde because of connection
failure will be of great help....
Cheers,
Binod
How are you opening the report? One solution to the problem would be
for the users to NOT open the report directly from the UI, but instead
open it by clicking a button on a form. You can then write code that
tests to see if the connection is still active. If it is, you open the
report. If it isn't, display your custom message.
--Mary
On Thu, 30 Dec 2004 04:59:01 -0800, "Abhi poddar"
<Abhipoddar@.discussions.microsoft.com> wrote:

>Hi,
> When I am trying to open Access 2003 report after SQL server is stopped I
>am getting following error:
>---
>Microsoft SQL Server Login
>---
>Connection failed:
>SQL Server Error: 53
>SQL Server does not exist or access denied.
>---
>Our requirement is to supress this error dialog and instead show customized
>msg.
>Any pointer how to supress error dialog in SQL msde because of connection
>failure will be of great help....
>Cheers,
>Binod

Connection timeout dialog

Hi,
When I am trying to open Access 2003 report after SQL server is stopped I
am getting following error:
---
Microsoft SQL Server Login
---
Connection failed:
SQL Server Error: 53
SQL Server does not exist or access denied.
---
Our requirement is to supress this error dialog and instead show customized
msg.
Any pointer how to supress error dialog in SQL msde because of connection
failure will be of great help....
Cheers,
BinodAbhi poddar (Abhipoddar@.discussions.microsoft.com) writes:
> When I am trying to open Access 2003 report after SQL server is
> stopped I am getting following error:
> ---
> Microsoft SQL Server Login
> ---
> Connection failed:
> SQL Server Error: 53
> SQL Server does not exist or access denied.
> ---
> Our requirement is to supress this error dialog and instead show
> customized msg.
> Any pointer how to supress error dialog in SQL msde because of connection
> failure will be of great help....
You would have to trap it with an ON ERROR and the look at the .Errors
collection. Presuming, that is, that you are using ADO. If you use DAO,
I don't have a clue.
In any case, this does not have much to do with SQL Server, but is something
you need to address in Access, so I would recommend asking in an Access
newsgroup.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Connection timeout dialog

Hi,
When I am trying to open Access 2003 report after SQL server is stopped I
am getting following error:
Microsoft SQL Server Login
Connection failed:
SQL Server Error: 53
SQL Server does not exist or access denied.
Our requirement is to supress this error dialog and instead show customized
msg.
Any pointer how to supress error dialog in SQL msde because of connection
failure will be of great help....
Cheers,
Binod
Abhi poddar (Abhipoddar@.discussions.microsoft.com) writes:
> When I am trying to open Access 2003 report after SQL server is
> stopped I am getting following error:
> Microsoft SQL Server Login
> Connection failed:
> SQL Server Error: 53
> SQL Server does not exist or access denied.
> Our requirement is to supress this error dialog and instead show
> customized msg.
> Any pointer how to supress error dialog in SQL msde because of connection
> failure will be of great help....
You would have to trap it with an ON ERROR and the look at the .Errors
collection. Presuming, that is, that you are using ADO. If you use DAO,
I don't have a clue.
In any case, this does not have much to do with SQL Server, but is something
you need to address in Access, so I would recommend asking in an Access
newsgroup.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Saturday, February 25, 2012

Connection Strings/Data Sources

Hey all,

I'm coming from ASP and I used to have a global connection string accessible to all of my ASP pages that I'd use for all of my data access. This was really convenient because I could easily switch to a backup or local data source for testing/debug by changing the connection string in one place.

Now, I'm using ASP.NET with Web Matrix and I love the drag and drop functionality but its dropping my connection string all over the place. How can I do this and keep my connection string in one spot so I can have the same convenience of switching data sources.

Thanks in advance!
LarryIf you are dropping connection objects, drag and drop functionality wasn't meant for that completely. You could try in your code to switch it to the connection in the web.config in one of the page events before it is used.

In the next version of Visual Studio, and most likely Visual Web Developer, you can use web.config entries in the connection objects.

Brian|||Hmmm...

So what can I do now? Should I define some kind of global string or an application variable with my database connection string and then search and replace all references to the connection string with that?

My application needs to be able to easily switch to a backup data source if the main source goes down.

Thanks in advance!
Larry|||I like the idea better of an n-tier architecture, where you have a data access layer that defines the connection information. However, if that's not for you, then I don't know what to tell you other than define the connection object in your web page. But then that throws off your datadapter or command objects dropped into the form.

I personally always created the database objects in the code because of that. Or look at changing the connection string in one of the page events. I think I got that concept to work in a windows form app, I think it may also work in a page event.

Brian

Friday, February 24, 2012

Connection string problem

I'm converting a simple Access application to ASP.NET with MSDE to run on our Intranet. The app has just one page with 2 SqlDataSource controls. Initially I configured the data source to connect directly to the .mdb file. Once I got the code running, I used the "Upsize Wizard" in Access to convert the data to a SQL database using the MSDE instance running on my web server. I then re-configured the SqlDataSources to connect to the MSDE database.

I am able to step all the way through the configuration wizard, and when I test the query, the correct data is returned. However, when I run the app (from within Visual Web Developer Express) I get the following exception when I bind a drop-down list to one of the SqlDataSources:

An OLE DB Provider was not specified in the ConnectionString.  An example would be, 'Provider=SQLOLEDB;'.
The connection string generated by the Wizard in my web.config is this:

<

addname="ConnectionString"connectionString="Data Source=BCFWEB01;Initial Catalog=InOut;User ID=XXX;Password=XXXXXXXXX"providerName="System.Data.SqlClient" />

Any idea why its complaining that I don't have an OLE DB provider, and why the query works fine from the Configuration Wizard but not when I run the page?

Thanks,

what is your code to bind your datasource? This errors mostly occurs when you are using OleDb connections in your code, and you have an Sql connection in your web.config file.|||Problem went away when I deleted & recreated the data source. I no longer have the code that didn't work :) but I suspect that's what the issue was. Thanks for the help!

Connection String Problem

Hi guys,
I was trying to access the northwind database by using the following codes:

conn =new SqlConnection("data source=localhost;integrated security=true;initial catalog=Northwind");daCustomers =new SqlDataAdapter("select CustomerID, CompanyName from Customers", conn);
ds =new DataSet();
daCustomers.Fill(ds,"Customers");
When I preview the aspx, I would fail with the following error:

SQL 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 44: daCustomers = new SqlDataAdapter("select CustomerID, CompanyName from Customers", conn);Line 45: ds = new DataSet();Line 46: daCustomers.Fill(ds, "Customers");Line 47: Line 48: //create the second DataTable

But now the strange thing is when I change the data source to (local):

conn =new SqlConnection("data source=(local);integrated security=true;initial catalog=Northwind");

It works! So my question is why would localhost fail while (local) works? Shouldn't these 2 be the same? Thanks in advance.

Silvertype:

It works! So my question is why would localhost fail while (local) works? Shouldn't these 2 be the same? Thanks in advance.

I always use (local) as the server name. As far as I understand it, ifyou want to use localhost then SQL Server needs to be configured to usea TCP/IP protocol, which isn't always the case.|||

I see. Btw, how do I configure SQL Server to use TCP/IP?

|||

Silvertype:

I see. Btw, how do I configure SQL Server to use TCP/IP?


As far as I know, it's via:Start -> Programs -> Microsoft SQL Server -> Client Network Utility|||Well, it seems like TCP/IP is already enabled for my sql server. However, localhost is still not working. Any idea?|||

Silvertype:

Well, it seems like TCP/IP is already enabled for my sql server. However, localhost is still not working. Any idea?


I do not know for sure. I always use (local).

Check out this blog post from Jon Galloway for some possible further help/explanation:[tip] localhost vs. (local) in SQL|||

Ok, thanks.

connection string in the SQL Server Management Studio Express

i want to change the database from access to SQL Server Management Studio Express

the old connection string in the asp is
<%
Set strConn = Server.CreateObject("Adodb.Connection")
Provider="provider=microsoft.jet.oledb.4.0;"
dbpath="data source=" & Server.MapPath("../data.mdb")
Pwd = ";jet oledb:database password=dolunlimit"
strConn.open provider & dbpath & Pwd
%>

i have write the new connection in the SQL server, but it can not work

<%
Set conn=CreateObject ("adodb.connection")
strConn="driver={SQL Server};server=192.168.0.102;uid=sa;Pwd=sa;database=sadb"
conn.open strConn
Set rs=CreateObject("adodb.recordset")
%>

can someone tell me what wrong of my coding

Tryhttp://www.connectionstrings.com for connection string help. Also, these forums are for ASP.NET-related questions, not classic ASP.

Sunday, February 19, 2012

Connection String for classic ASP global.asa to SQL Server 2005

I migrated my SQL Server 7 database to the new SQL Server 2005 that I installed on my PC. I have classic ASP programs on my PC that used to access the SQL Server 7 database. However, global.asa and these ASP programs can no longer connect to the new SS 2005 database.

The access to the SS 2005 instance is with Local System for "Log on as".

I've tried all the following connection strings in my global.asa and they don't work.

dbConnect = "Data Source=CURT-DELL/curt;Initial Catalog=MyDatabaseName;Persist Security Info=True;User ID=curt;Password="

dbConnect = "Data Source=C:\Program Files\Microsoft SQL Server\MSSQL\Data\MyDatabaseName_DATA.MDF;Initial Catalog=MyDatabaseName;Integrated Security=True"

dbConnect = "Data Source=MyComputerName/curt;Initial Catalog=MyDatabaseName;Trusted_Connection=Yes"

dbConnect = "Provider = SQLOLEDB.1;Data Source = (local)\MSSQLSERVER;Initial Catalog=<MyDatabaseName>;User ID = <curt>;Password = <__>;"

bConnect = "Data Source=MyComputerName;Initial Catalog=MyDatabaseName;Integrated Security=True"

dbConnect = "Driver={SQL Server};" & _

"Server=(local);" & _

"Database=MyDatabaseName;Uid=MyComputerName\curt;"

dbConnect = "Provider=SQLOLEDB; Data Source = (local); Initial Catalog = MyDatabaseName; User Id = MyComputerName\curt; Password=_"

Does anybody know how to solve the problem?

what logon authentication are you using? Windows or SQL Server?

for Windows:

dbConnect = "Provider=SQLOLEDB; Data Source = Data Source=MyComputerName\MSSQL; Initial Catalog = MyDatabaseName; Integrated Security=SSPI"


for SQL Server:
dbConnect = "Provider=SQLOLEDB; Data Source = Data Source=MyComputerName\MSSQL; Initial Catalog = MyDatabaseName;User Id=curt; Password=_"

keep this URL handy: http://www.connectionstrings.com|||

Thanks for your posting. I tried both of your connection strings, but to no avail. I've already tried the connection strings at www.connectionstrings.com. I've even tried contacting the author at

This is incredibly frustrating.

I've even tried "(local)" instead of MyComputerName.

I tried to confirm the User Id and Password in SQL Server 2005. When I look at the properties for the Users in SQL Server 2005, it doesn't show the passwords for the users. Do you know why it doesn't?

|||I just started trying to connect my classic applications to sql server 2005 today and am experiencing the same problems you have reported. Just wondering if you had any success since you posted?

|||

SQL Server 2005 is very different than SQL Server 7. It has several more security walls that prevent access. I suggest looking at the whitepaper on my blog that discusses how to get connected. I would also consider moving to ASP.NET as it's far more stable, performs better and supports the .NET Framwork which integrates better with the current set of tools. See http://betav.com/blog/billva/2006/06/getting_and_staying_connected.html

Consider that while both SQL Server and SSPI authentication make sense, they both require special configuration on the target SQL Server. SQL Server only supports SSPI authentication by default. This also means that you need to configure the SQL Server account that's used by IIS to handle ASP connections. This account needs to be granted access to the target database (Initial Catalog).

hth

|||Thanks for the suggestions. All that was very informative reading. I have bookmarked it all. However, I have gotten my connections to work. It seems that 2005 is now case sensitive. I have not read anywhere about this as a difference, but all I can say is that 'CASE' makes a difference.

|||Nope, SQL Server 2005 is not case-sensitive by default. While it can be installed that way, the TSQL and the ConnectionString are not case-sensitive unless you configure it so. Do you have a reproducible example?|||

Then, they must have set us up to be case sensitive. It made a difference for all of my apps. Classic and asp.net.

What about the passwords? Once I got connected, I had to modify the passwords in my connection strings to the proper case. The logins were a mix of upper and lower case but the old strings were just lower case. They work fine with the 2000 databases, but I had to use the proper case for the 2005 versions.

|||

Passwords are always case sensitive but if the server is configured as case-sensitive then all object names (databases, tables, stored procedures, columns... everything) and TSQL is case-sensitive. I never recommend installing SQL Server as case-sensitive any more as you can get the case-sensitive benefits by judicious use of TSQL operators that test for case on the fly.

hth