Sunday, March 25, 2012
Connecto to remote SQL Server
I want to connect a program (like query analyzer) in home, to the sql server in office via internet, but i can't log in to the remote server. Someone know how to establish the connection?
Thanks to all of you!!!You will need to get permission from you network group to VPN into the network.|||thank you, but can you be a little more detailed?|||You need to talk to your network group and have them give you VPN access and tell you how to use it.|||I've tryed lot of things but cant connect!!!!, i try to establish a VPN in win 2k3 server as Server and winXP Prof as client, but it is impossible to get connected!!!
I finally get the VPN connection, i've missing directives, but now i cant connect to SQL Server!
Monday, March 19, 2012
ConnectionOpen (PreLoginHandshake()). General Network Error
I'm getting the following error on my SQL on a local machine when running a
client program that connects to sql server located at the same machine. What
does it means? Do i have to configure in SQL settings?
[DBNETLIB]ConnectionOpen (PreLoginHandshake()). General Network Error.
thanks,
joelNormally this message would indicate a timeout of some kind attempting to
connect. Open the SQL Client Network Utility and see if Shared Memory is
enabled. If it is not enable it and see if the problem goes away. Local
connections by default should use shared memory so it would appear that
this is not enabled.
Rand
This posting is provided "as is" with no warranties and confers no rights.
Sunday, March 11, 2012
Connection works for a while then gets this : [DBMSLPCN]SQL Server does not exist or acces
We have some custom code running on microsoft great plains **under
terminal services** on a windows 2003 machine.
We have a program (running under great plains) that will run for about
5 minutes, then give the error
[Microsoft][ODBC SQL Server Driver][DBMSLPNCN]SQL Server does not exist
or access denied.
I've tried disabling the shared memory protocol in the client network
utility. That didn't have any effect...even though the error points to
the shared memory protocol.
Now, I've got aql running on a non-standard port or 1150. If I change
this back to the default 1433, the program works fine.
Any ideas why?
Steven Vallarian
Hi
You may look at netstat to see what is connected to the ports of use PortQry
to see if you can connect:
http://support.microsoft.com/default...b;en-us;310099
It may be that you just have general network problems such as a faulty
switch.
John
"svallarian" <svallarian@.hotmail.com> wrote in message
news:1109778822.752029.318690@.l41g2000cwc.googlegr oups.com...
> Situation:
> We have some custom code running on microsoft great plains **under
> terminal services** on a windows 2003 machine.
> We have a program (running under great plains) that will run for about
> 5 minutes, then give the error
> [Microsoft][ODBC SQL Server Driver][DBMSLPNCN]SQL Server does not exist
> or access denied.
> I've tried disabling the shared memory protocol in the client network
> utility. That didn't have any effect...even though the error points to
> the shared memory protocol.
> Now, I've got aql running on a non-standard port or 1150. If I change
> this back to the default 1433, the program works fine.
> Any ideas why?
>
> Steven Vallarian
>
Connection works for a while then gets this : [DBMSLPCN]SQL Server does not exist or a
We have some custom code running on microsoft great plains **under
terminal services** on a windows 2003 machine.
We have a program (running under great plains) that will run for about
5 minutes, then give the error
[Microsoft][ODBC SQL Server Driver][DBMSLPNCN]SQL Server does no
t exist
or access denied.
I've tried disabling the shared memory protocol in the client network
utility. That didn't have any effect...even though the error points to
the shared memory protocol.
Now, I've got aql running on a non-standard port or 1150. If I change
this back to the default 1433, the program works fine.
Any ideas why?
Steven VallarianHi
You may look at netstat to see what is connected to the ports of use PortQry
to see if you can connect:
http://support.microsoft.com/defaul...kb;en-us;310099
It may be that you just have general network problems such as a faulty
switch.
John
"svallarian" <svallarian@.hotmail.com> wrote in message
news:1109778822.752029.318690@.l41g2000cwc.googlegroups.com...
> Situation:
> We have some custom code running on microsoft great plains **under
> terminal services** on a windows 2003 machine.
> We have a program (running under great plains) that will run for about
> 5 minutes, then give the error
> [Microsoft][ODBC SQL Server Driver][DBMSLPNCN]SQL Server does
not exist
> or access denied.
> I've tried disabling the shared memory protocol in the client network
> utility. That didn't have any effect...even though the error points to
> the shared memory protocol.
> Now, I've got aql running on a non-standard port or 1150. If I change
> this back to the default 1433, the program works fine.
> Any ideas why?
>
> Steven Vallarian
>
Connection to SQL2k5 from OLEDB
use OLEDB (not ADO) to connect to server. Name of provider (OLEDB) is
hardcoded in the program. May I connect to SQL2k5 without change it in
program and recompile it, with use of old OLEDB provider? The program big,
and it will be necessary to change it in several places...Hi
AFAIK you should be ok with the application as is, you will not be able to
use the features of the SQL Native Client.
John
"andsm" wrote:
> I have program which work with SQL2k. The program was written on C++ and i
t
> use OLEDB (not ADO) to connect to server. Name of provider (OLEDB) is
> hardcoded in the program. May I connect to SQL2k5 without change it in
> program and recompile it, with use of old OLEDB provider? The program big,
> and it will be necessary to change it in several places...|||You are right, as far as you don=B4t need the new features you can get
pre-SQL 2k5 functionality with the old providers. Only SNAC with its
new providers or .NET 2.0 will take you to the heaven of SQL2k5 ;-)
(=2ENET 2.0 even a bit higher)
HTH, Jens Suessmeyer.
Connection to SQL2k5 from OLEDB
use OLEDB (not ADO) to connect to server. Name of provider (OLEDB) is
hardcoded in the program. May I connect to SQL2k5 without change it in
program and recompile it, with use of old OLEDB provider? The program big,
and it will be necessary to change it in several places...Hi
AFAIK you should be ok with the application as is, you will not be able to
use the features of the SQL Native Client.
John
"andsm" wrote:
> I have program which work with SQL2k. The program was written on C++ and it
> use OLEDB (not ADO) to connect to server. Name of provider (OLEDB) is
> hardcoded in the program. May I connect to SQL2k5 without change it in
> program and recompile it, with use of old OLEDB provider? The program big,
> and it will be necessary to change it in several places...|||You are right, as far as you don=B4t need the new features you can get
pre-SQL 2k5 functionality with the old providers. Only SNAC with its
new providers or .NET 2.0 will take you to the heaven of SQL2k5 ;-)
(=2ENET 2.0 even a bit higher)
HTH, Jens Suessmeyer.
Connection to SQL2k5 from OLEDB
use OLEDB (not ADO) to connect to server. Name of provider (OLEDB) is
hardcoded in the program. May I connect to SQL2k5 without change it in
program and recompile it, with use of old OLEDB provider? The program big,
and it will be necessary to change it in several places...
Hi
AFAIK you should be ok with the application as is, you will not be able to
use the features of the SQL Native Client.
John
"andsm" wrote:
> I have program which work with SQL2k. The program was written on C++ and it
> use OLEDB (not ADO) to connect to server. Name of provider (OLEDB) is
> hardcoded in the program. May I connect to SQL2k5 without change it in
> program and recompile it, with use of old OLEDB provider? The program big,
> and it will be necessary to change it in several places...
|||You are right, as far as you don=B4t need the new features you can get
pre-SQL 2k5 functionality with the old providers. Only SNAC with its
new providers or .NET 2.0 will take you to the heaven of SQL2k5 ;-)
(=2ENET 2.0 even a bit higher)
HTH, Jens Suessmeyer.
Connection to SQL Server with network login id when not logged
stuff, every morning connects to a SQL Server that requires a login by
network login id. The problem is that, even if that scheduled task runs
as the network user, it doesn't work if that user is not logged on.
Is it any way to make ir connect when not logged?
Thanks in advance.
By "scheduled task" I assume that to mean that it is set to run using SQL
Agent. If so, then you need to assign the SQL Agent service to run as a
specific windows domain id and that id in turn needs to be granted access to
your SQL Server instance and database(s).
--Brian
(Please reply to the newsgroups only.)
<axl@.todojuegos.com> wrote in message
news:1123149165.623223.184430@.g44g2000cwa.googlegr oups.com...
> I have a scheduled task that executes a program that, among other
> stuff, every morning connects to a SQL Server that requires a login by
> network login id. The problem is that, even if that scheduled task runs
> as the network user, it doesn't work if that user is not logged on.
> Is it any way to make ir connect when not logged?
> Thanks in advance.
>
Connection to SQL Server with network login id when not logged
stuff, every morning connects to a SQL Server that requires a login by
network login id. The problem is that, even if that scheduled task runs
as the network user, it doesn't work if that user is not logged on.
Is it any way to make ir connect when not logged?
Thanks in advance.By "scheduled task" I assume that to mean that it is set to run using SQL
Agent. If so, then you need to assign the SQL Agent service to run as a
specific windows domain id and that id in turn needs to be granted access to
your SQL Server instance and database(s).
--Brian
(Please reply to the newsgroups only.)
<axl@.todojuegos.com> wrote in message
news:1123149165.623223.184430@.g44g2000cwa.googlegroups.com...
> I have a scheduled task that executes a program that, among other
> stuff, every morning connects to a SQL Server that requires a login by
> network login id. The problem is that, even if that scheduled task runs
> as the network user, it doesn't work if that user is not logged on.
> Is it any way to make ir connect when not logged?
> Thanks in advance.
>
Connection to SQL Server 2005 lost
(Provider=sqloledb) and MDAC 2.8. This program has worked flawlessly for
years, but after upgrading to SQL Server 2005, the database connection is
sometimes lost during larger operation involving open/close of several
recordsets. The general error message says:
“[DBNETLIB][ConnectionOpen,Connect()).]SQL Server does not exsist or access
denied". "Simpler" parts of the program involving just a recordset or two
always work fine. Any idea of what is going on here?
Have you tried using the SQL Native Client (SNAC) instead to see if that
makes a difference?
http://msdn2.microsoft.com/en-us/data/aa937733.aspx
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Glenn Handeland" <Glenn Handeland@.discussions.microsoft.com> wrote in
message news:9A2E8820-DEFC-4209-B019-8A0996CF7FDF@.microsoft.com...
> We have developed a VB6 client program accsessing SQL Sever 7.0 via ADO
> (Provider=sqloledb) and MDAC 2.8. This program has worked flawlessly for
> years, but after upgrading to SQL Server 2005, the database connection is
> sometimes lost during larger operation involving open/close of several
> recordsets. The general error message says:
> “[DBNETLIB][ConnectionOpen,Connect()).]SQL Server does not exsist or
> access
> denied". "Simpler" parts of the program involving just a recordset or two
> always work fine. Any idea of what is going on here?
|||Thank you for the suggestion.
We have not tried the native client, because the FAQ says:
Q. Must I upgrade clients to use SQL Native Client as soon as I upgrade my
server?
A. Applications deployed before SQL Server 2005 was released can and should
continue to use MDAC.
Most likely it is a server configuration problem. Our program is used by
many clients, accessing the datebase from different computers/configurations,
and all of them experience this error message when conneting to a given SQL
Server 2005 Server. Some of our clients from other firms also have their own
SQL Server 2005 running, and they have successfully managed to connect to
their database using MDAC and never experience this error message.
"Andrew J. Kelly" wrote:
> Have you tried using the SQL Native Client (SNAC) instead to see if that
> makes a difference?
> http://msdn2.microsoft.com/en-us/data/aa937733.aspx
>
> --
> Andrew J. Kelly SQL MVP
> Solid Quality Mentors
>
> "Glenn Handeland" <Glenn Handeland@.discussions.microsoft.com> wrote in
> message news:9A2E8820-DEFC-4209-B019-8A0996CF7FDF@.microsoft.com...
>
|||Sorry I don't have another answer for you. I have not heard of or seen this
particular issue before.
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Glenn Handeland" <GlennHandeland@.discussions.microsoft.com> wrote in
message news:C425386F-DA1A-4D79-AEFB-AE29F7AC6606@.microsoft.com...[vbcol=seagreen]
> Thank you for the suggestion.
> We have not tried the native client, because the FAQ says:
> Q. Must I upgrade clients to use SQL Native Client as soon as I upgrade my
> server?
> A. Applications deployed before SQL Server 2005 was released can and
> should
> continue to use MDAC.
> Most likely it is a server configuration problem. Our program is used by
> many clients, accessing the datebase from different
> computers/configurations,
> and all of them experience this error message when conneting to a given
> SQL
> Server 2005 Server. Some of our clients from other firms also have their
> own
> SQL Server 2005 running, and they have successfully managed to connect to
> their database using MDAC and never experience this error message.
>
> "Andrew J. Kelly" wrote:
|||Ah, I would STILL upgrade to SNAC. I agree that if the application is
working and deployed it should not be disturbed, but yours is not working
and SNAC solves any number of issues like this.
__________________________________________________ ________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
__________________________________________________ __________________________________________
"Glenn Handeland" <GlennHandeland@.discussions.microsoft.com> wrote in
message news:C425386F-DA1A-4D79-AEFB-AE29F7AC6606@.microsoft.com...[vbcol=seagreen]
> Thank you for the suggestion.
> We have not tried the native client, because the FAQ says:
> Q. Must I upgrade clients to use SQL Native Client as soon as I upgrade my
> server?
> A. Applications deployed before SQL Server 2005 was released can and
> should
> continue to use MDAC.
> Most likely it is a server configuration problem. Our program is used by
> many clients, accessing the datebase from different
> computers/configurations,
> and all of them experience this error message when conneting to a given
> SQL
> Server 2005 Server. Some of our clients from other firms also have their
> own
> SQL Server 2005 running, and they have successfully managed to connect to
> their database using MDAC and never experience this error message.
>
> "Andrew J. Kelly" wrote:
|||We upgraded to SNAC, but still experience the very same error. The text of
the error message reported is a little bit different, thought. It now says
"Named Pipes Provider: No process is on the other end of the pipe." We did
get rid of the error message when we changed the recordsets cursor from
server-side to client-side (CursorLocation = adUseClient).
"William Vaughn" wrote:
> Ah, I would STILL upgrade to SNAC. I agree that if the application is
> working and deployed it should not be disturbed, but yours is not working
> and SNAC solves any number of issues like this.
> --
> __________________________________________________ ________________________
> William R. Vaughn
> President and Founder Beta V Corporation
> Author, Mentor, Dad, Grandpa
> Microsoft MVP
> (425) 556-9205 (Pacific time)
> Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
> __________________________________________________ __________________________________________
> "Glenn Handeland" <GlennHandeland@.discussions.microsoft.com> wrote in
> message news:C425386F-DA1A-4D79-AEFB-AE29F7AC6606@.microsoft.com...
>
|||You are putting less work on the SQL Server by doing that and is generally a
good idea anyway. But you should also think about changing to TCP instead of
using named pipes.
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Glenn Handeland" <GlennHandeland@.discussions.microsoft.com> wrote in
message news:530FDB75-0B6B-46E3-A9CA-FFD3E2B3F75F@.microsoft.com...[vbcol=seagreen]
> We upgraded to SNAC, but still experience the very same error. The text of
> the error message reported is a little bit different, thought. It now says
> "Named Pipes Provider: No process is on the other end of the pipe." We did
> get rid of the error message when we changed the recordsets cursor from
> server-side to client-side (CursorLocation = adUseClient).
>
> "William Vaughn" wrote:
|||It sounds like the server is rejecting the Open. Make sure that the server
configuration is not limiting the total number of connections in any way.
These might have been configured to comply with license or other artifical
constraints.
__________________________________________________ ________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
__________________________________________________ __________________________________________
"Glenn Handeland" <GlennHandeland@.discussions.microsoft.com> wrote in
message news:530FDB75-0B6B-46E3-A9CA-FFD3E2B3F75F@.microsoft.com...[vbcol=seagreen]
> We upgraded to SNAC, but still experience the very same error. The text of
> the error message reported is a little bit different, thought. It now says
> "Named Pipes Provider: No process is on the other end of the pipe." We did
> get rid of the error message when we changed the recordsets cursor from
> server-side to client-side (CursorLocation = adUseClient).
>
> "William Vaughn" wrote:
Connection to SQL Server 2005 lost
(Provider=sqloledb) and MDAC 2.8. This program has worked flawlessly for
years, but after upgrading to SQL Server 2005, the database connection is
sometimes lost during larger operation involving open/close of several
recordsets. The general error message says:
“[DBNETLIB][ConnectionOpen,Connect()).]SQL Server does not exsist
or access
denied". "Simpler" parts of the program involving just a recordset or two
always work fine. Any idea of what is going on here?Have you tried using the SQL Native Client (SNAC) instead to see if that
makes a difference?
http://msdn2.microsoft.com/en-us/data/aa937733.aspx
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Glenn Handeland" <Glenn Handeland@.discussions.microsoft.com> wrote in
message news:9A2E8820-DEFC-4209-B019-8A0996CF7FDF@.microsoft.com...
> We have developed a VB6 client program accsessing SQL Sever 7.0 via ADO
> (Provider=sqloledb) and MDAC 2.8. This program has worked flawlessly for
> years, but after upgrading to SQL Server 2005, the database connection is
> sometimes lost during larger operation involving open/close of several
> recordsets. The general error message says:
> “[DBNETLIB][ConnectionOpen,Connect()).]SQL Server does not exsis
t or
> access
> denied". "Simpler" parts of the program involving just a recordset or two
> always work fine. Any idea of what is going on here?|||Thank you for the suggestion.
We have not tried the native client, because the FAQ says:
Q. Must I upgrade clients to use SQL Native Client as soon as I upgrade my
server?
A. Applications deployed before SQL Server 2005 was released can and should
continue to use MDAC.
Most likely it is a server configuration problem. Our program is used by
many clients, accessing the datebase from different computers/configurations
,
and all of them experience this error message when conneting to a given SQL
Server 2005 Server. Some of our clients from other firms also have their own
SQL Server 2005 running, and they have successfully managed to connect to
their database using MDAC and never experience this error message.
"Andrew J. Kelly" wrote:
> Have you tried using the SQL Native Client (SNAC) instead to see if that
> makes a difference?
> http://msdn2.microsoft.com/en-us/data/aa937733.aspx
>
> --
> Andrew J. Kelly SQL MVP
> Solid Quality Mentors
>
> "Glenn Handeland" <Glenn Handeland@.discussions.microsoft.com> wrote in
> message news:9A2E8820-DEFC-4209-B019-8A0996CF7FDF@.microsoft.com...
>|||Sorry I don't have another answer for you. I have not heard of or seen this
particular issue before.
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Glenn Handeland" <GlennHandeland@.discussions.microsoft.com> wrote in
message news:C425386F-DA1A-4D79-AEFB-AE29F7AC6606@.microsoft.com...[vbcol=seagreen]
> Thank you for the suggestion.
> We have not tried the native client, because the FAQ says:
> Q. Must I upgrade clients to use SQL Native Client as soon as I upgrade my
> server?
> A. Applications deployed before SQL Server 2005 was released can and
> should
> continue to use MDAC.
> Most likely it is a server configuration problem. Our program is used by
> many clients, accessing the datebase from different
> computers/configurations,
> and all of them experience this error message when conneting to a given
> SQL
> Server 2005 Server. Some of our clients from other firms also have their
> own
> SQL Server 2005 running, and they have successfully managed to connect to
> their database using MDAC and never experience this error message.
>
> "Andrew J. Kelly" wrote:
>|||Ah, I would STILL upgrade to SNAC. I agree that if the application is
working and deployed it should not be disturbed, but yours is not working
and SNAC solves any number of issues like this.
________________________________________
__________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
________________________________________
____________________________________
________________
"Glenn Handeland" <GlennHandeland@.discussions.microsoft.com> wrote in
message news:C425386F-DA1A-4D79-AEFB-AE29F7AC6606@.microsoft.com...[vbcol=seagreen]
> Thank you for the suggestion.
> We have not tried the native client, because the FAQ says:
> Q. Must I upgrade clients to use SQL Native Client as soon as I upgrade my
> server?
> A. Applications deployed before SQL Server 2005 was released can and
> should
> continue to use MDAC.
> Most likely it is a server configuration problem. Our program is used by
> many clients, accessing the datebase from different
> computers/configurations,
> and all of them experience this error message when conneting to a given
> SQL
> Server 2005 Server. Some of our clients from other firms also have their
> own
> SQL Server 2005 running, and they have successfully managed to connect to
> their database using MDAC and never experience this error message.
>
> "Andrew J. Kelly" wrote:
>
Wednesday, March 7, 2012
Connection to database problems
Hi,
I am trying to create a program in VS2005 - C# that uses SQL Express as it's database.
Here is the connection string:
@."Data Source=(local)\SQLEXPRESS;Initial Catalog=MyBookings;Integrated Security=True";
Here is the result from the log file:
2007-03-21 10:49:44.36 Logon Login failed for user 'AQUARIUS\Administrator'. [CLIENT: <local machine>]
I could play with this manually and probably get it working BUT this is a solution that is to be installed on computers by users who will have no knowledge of SQL Express.
The database needs to be accessible by the program without user intervention.
How do I go about this or fix the above problem?
Thanks.
hi,
the connection string is correct, so you should check the actual connecting Windows login has been granted connection permissions to the Express instance...
loosely speaking, SQL Server manages security using a so called "2 phases" authentication policy..
the first one is dedicated to connection action, where the provided credentials are validated against the granted logins "list"... granted logins are "principals", both standard SQL Server logins (requiring explicit user name and password credentials) and Windows logins (where only the relative sid is provided as credential as already authenticated by the domain controller/computer they are member of) that have been granted permissions to log in the specified SQL Server instance... for standard logins, like "sa", you have to manage each specific login, where, for Windows logins, you can both manage them at single login granularity as long as at Group granularity..
So, for Windows logins, you can grant connection permissions at "AQUARIUS\AccountName" or, for group management, at "AQUARIUS\GroupName" the specified account is member of...
by default, SQL Server 2005 grants login permissions for integrated security validated connections at LocalAdministrators (BUILTIN\Administrators) and LocalUsers (BUILTIN\Users) members, but you have to manage as required further logins or groups, as long as to a special standard SQL Server login, "sa", if non integrated security (or "mixed security") connections have been enabled as well..
If the provided credentials can not be validated, the connection is refused and the exception you provided is raised...
when the first security phase has been positively validated, SQL Server proceeds in the second one, regarding database access to the specified one... every kind of server level principal but members of the sysadmins server role requires explicit database access permission via a mapping to a database level principal, usually known as a "database user"..
when resolved, the particular login, mapped to a specified database user, can "access" the specified database... then additional security factors comes to play, to permit security constraints at database object level, like table, view, stored procedure, ...., and with more granularity as well, at column level for tables and views database objects, in order to grant permissions according to the required security path, so that only particular database principals can execute the particular stored procedure(s) or select from the particular table(s) or update the particular table(s)...
regards
|||if your DB is in Local computer use this
SqlConnection myConnection = new SqlConnection("server=(local)\\SQLEXPRESS;Integrated Security=SSPI;database=yourDBname");
if your DB is in App_Data folder use this
SqlConnection myConnection = new SqlConnection("Data Source=.\\SQLEXPRESS; AttachDbFilename=|DataDirectory|\\yourDBname.mdf;Integrated Security=True;User Instance=True");
Thanks
www.sqltree.com
Friday, February 24, 2012
Connection string for VBEE to SQL 2005
The data source is set to .\SQLEXPRESS in the advanced properties of the Add Connection form in the Data Source Configuration Wizard and you can not change it.
I read in MSDN ID 329721 that you can create a data layer that will allow you to use the wizards, but that is as far as it went and is above my programming skills.
So my only options are use VB.Net 2003 Standard edition, use connected mode or give up and it was only supposed to be a quick fix. Had anyone else had this same issue and developed a work around?I have entered the following
Imports System.Data.SqlClient
Imports System.Data.OleDb
Public Class Form1
Public SQLPubsConnString As String = "Provider=SQLOLEDB;Data Source=TOTALLY-PBN-FS;Integrated Security=SSPI;Initial Catalog=Sword of Destiny Back End_Data.MDF"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cn As New OleDbConnection
cn.ConnectionString = SQLPubsConnString
cn.Open()
End Sub
and I get this error:
Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
I have no idea what this mean, I tried to connect to the help files and nothing, any clues would be appreciated|||Quick rant, why did Microsoft not include SQL 2005 within the Add Connection in VBEE, it is totally stupid?|||to connect to sql2005, you can use a connstr like this (assuming windows auth)
server=MYSERVER; database=MYDB; trusted_connection=yes;
many more examples here:
http://www.connectionstrings.com|||Many thanks, I tried it and it asks for a provider, I then enter one and it comes up with the same message. I had already located that excellent site and I have tried various permutations and no joy. I am using Windows Authorization by the way.
Sadly it looks like I will have to continue using my Access MDB front end that keeps getting ODBC timeouts which is not solvable.|||I worked out what it was while lying in bed, and sorted it this morning, it seems that as I had stored the project on a network drive it was tripping on security, as soon as I moved the project to My Documents the connection string worked, doh!!!|||you can store in your web.config
<add key="ConnectionString"
value="Server=(local);Database=yourDataBaseName;User ID=;Password=;Trusted_Connection=True"
/>
the keywords (local) works for localhost|||Thanks for your advice I will remember that as I will be setting up something for the Web, in the end I did this:
Public WithEvents cnn As New SqlConnection
Public SQLPubsConnString As String = "data source=TOTALLY-PBM-FS;Initial Catalog=Sword of Destiny Back End;Integrated Sec
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim SQLGetControlFormData As String
Dim SQLcommand As New SqlCommand
SQLGetControlFormData = "Select ID, [Character Name], Month, Year From dbo.[Control Form]"
cnn.ConnectionString = SQLPubsConnString
cnn.Open()
SQLcommand.Connection = cnn
SQLcommand.CommandText = SQLGetControlFormData
Dim DRControlForm As SqlDataReader = SQLcommand.ExecuteReader
Do While DRControlForm.Read()
Debug.WriteLine(DRControlForm.Item("ID"))
combobox6.
Loop
DRControlForm.Close()
SQLcommand.Dispose()
I can see the data in the immediate window, so its there, my next challenge is to work out how to get the data into the Form. And to do something like this which I Was doing in Access:
' GetUnitIDSQL = "SELECT [Unit Details].ID, [Unit Details].[Unit Name], [Unit Details].[Unit Type], [Unit Details].[Paid By], [Unit Details].Country, " & _
' "[Unit Details].[Province based], [Unit Details].[Training Level], [Unit Details].[Location], [Unit Details].[Wages PM] " & _
' "FROM [Unit Details] " & _
' "WHERE ((([Unit Details].[ID])=" & UNitID & ") AND (([Unit Details].[Unit Type])=" & "'" & UnitType & "'" & ") " & _
' "AND (([Unit Details].[Paid By])=" & CharID & ") AND (([Unit Details].Country)=" & "'" & Country & "'" & ") AND (([Unit Details].[Province based])=" & "'" & Province & "'" & "));"
' qdf2 = db.CreateQueryDef("Hewitt5734", GetUnitIDSQL)
' rs2 = db.OpenRecordset("Hewitt5734", Type:=dbOpenSnapshot)
' With rs2
' CountB = .RecordCount
' If CountB = 1 Then
' UnitName = .Fields("Unit Name")
' WagesPM = .Fields("Wages PM")
' StartSector = .Fields("Location")
' End If
' End With
' 'db.OpenRecordset("Hewitt5734").Close
' db.QueryDefs.Delete("Hewitt5734")
I do not intend to change any data I bring into the form, I want to use an Update SQL Query at the end to add new records in another table and update certain related records in another Table. As I can't use disconnected mode with this which is with the Wizards working of course then I have to use connected mode.