Re: Cannot connect to db

Discussion in 'ASP .Net' started by John Giblin, Jul 16, 2003.

  1. John Giblin

    John Giblin Guest

    I just forgot that in that try. No affect. Still cannot connect. It seems
    like a configuration on my mchine since it worked for someone else with the
    same code

    John
    "Jon Yates" <> wrote in message
    news:00b401c34baa$90764760$...
    > Hello mate.
    >
    > In your connection string you may need to supply the
    > Username and Password to the Database. I've pasted in the
    > connection sring that I use from within a Windows App to
    > connection to a SQLServer 2000 DB.
    >
    > Hope it helps,
    >
    > Jon
    >
    > "Provider=sqloledb;data source=SUNWL19655\NetSDK;initial
    > catalog=Portal; user id=sa; password="
    >
    > >-----Original Message-----
    > >I have written both a asp.net and a console program where

    > I am trying to
    > >connection to a db.
    > >
    > >When I use the sqlconnection using vs.net 2003. I am able

    > to see the table
    > >and the test the connection
    > >
    > >When I run my program I get an error! ARGh!
    > >
    > >In my console program I get:
    > >Error Request for the permission of type
    > >System.Data.SqlClient.SqlClientPermission, System.Data,

    > Version=1.0.5000.0,
    > >Cul
    > >ture=neutral, PublicKeyToken=b77a5c561934e089 failed.
    > >
    > >In my asp.net i get this:
    > >Exception Details: System.UnauthorizedAccessException:

    > Access is denied.
    > >
    > >It fails at the open():
    > >Console program
    > >
    > >string strConnect = "workstation id=NYCNJGIBLIN;packet

    > size=4096;user
    > >id=jgiblin;data source=ewr1gpdsq" +
    > >
    > >"l;persist security info=False"; }
    > >
    > >SqlConnection conn = new SqlConnection(strConnect);
    > >
    > >SqlCommand cmd = new SqlCommand("Select * from

    > Content_Master", conn);
    > >
    > >// cmd.Connection = new SqlConnection(strConnect);
    > >
    > >// cmd.CommandText = "Content_Master_Update";
    > >
    > >cmd.CommandType = CommandType.Text;
    > >
    > >test = "Step 2";
    > >
    > >test = "Step 3";
    > >
    > >conn.Open();
    > >
    > >
    > >
    > >
    > >.
    > >
     
    John Giblin, Jul 16, 2003
    #1
    1. Advertising

  2. John Giblin

    dj Bass Guest

    if it's taken from another machine, then the things you need to check out
    are the domains for the database boxes you're trying to access... does the
    network machine exist with the same mappings as on the original PC? if it's
    a different database instance, then you should probably start the connection
    from scratch again.

    i still say try the design view, you see more happening there in front of
    you without worry about strings of info...

    Dan.

    "John Giblin" <> wrote in message
    news:...
    > I just forgot that in that try. No affect. Still cannot connect. It

    seems
    > like a configuration on my mchine since it worked for someone else with

    the
    > same code
    >
    > John
    > "Jon Yates" <> wrote in message
    > news:00b401c34baa$90764760$...
    > > Hello mate.
    > >
    > > In your connection string you may need to supply the
    > > Username and Password to the Database. I've pasted in the
    > > connection sring that I use from within a Windows App to
    > > connection to a SQLServer 2000 DB.
    > >
    > > Hope it helps,
    > >
    > > Jon
    > >
    > > "Provider=sqloledb;data source=SUNWL19655\NetSDK;initial
    > > catalog=Portal; user id=sa; password="
    > >
    > > >-----Original Message-----
    > > >I have written both a asp.net and a console program where

    > > I am trying to
    > > >connection to a db.
    > > >
    > > >When I use the sqlconnection using vs.net 2003. I am able

    > > to see the table
    > > >and the test the connection
    > > >
    > > >When I run my program I get an error! ARGh!
    > > >
    > > >In my console program I get:
    > > >Error Request for the permission of type
    > > >System.Data.SqlClient.SqlClientPermission, System.Data,

    > > Version=1.0.5000.0,
    > > >Cul
    > > >ture=neutral, PublicKeyToken=b77a5c561934e089 failed.
    > > >
    > > >In my asp.net i get this:
    > > >Exception Details: System.UnauthorizedAccessException:

    > > Access is denied.
    > > >
    > > >It fails at the open():
    > > >Console program
    > > >
    > > >string strConnect = "workstation id=NYCNJGIBLIN;packet

    > > size=4096;user
    > > >id=jgiblin;data source=ewr1gpdsq" +
    > > >
    > > >"l;persist security info=False"; }
    > > >
    > > >SqlConnection conn = new SqlConnection(strConnect);
    > > >
    > > >SqlCommand cmd = new SqlCommand("Select * from

    > > Content_Master", conn);
    > > >
    > > >// cmd.Connection = new SqlConnection(strConnect);
    > > >
    > > >// cmd.CommandText = "Content_Master_Update";
    > > >
    > > >cmd.CommandType = CommandType.Text;
    > > >
    > > >test = "Step 2";
    > > >
    > > >test = "Step 3";
    > > >
    > > >conn.Open();
    > > >
    > > >
    > > >
    > > >
    > > >.
    > > >

    >
    >
     
    dj Bass, Jul 16, 2003
    #2
    1. Advertising

  3. John Giblin

    John Giblin Guest

    Like I said. I used the VS.net to create the connection string and I was
    able to view the databases. I also used the test connection, which worked

    What I need to know, is what the differences are between, the vs.net env and
    asp. I have intergrated security on that server and in the webinfo file,
    impersonate is set to false ( I have played with that either way)

    Do I need the latest mdac? and why would the console program not work.

    John
    "dj Bass" <> wrote in message
    news:...
    > if it's taken from another machine, then the things you need to check out
    > are the domains for the database boxes you're trying to access... does the
    > network machine exist with the same mappings as on the original PC? if

    it's
    > a different database instance, then you should probably start the

    connection
    > from scratch again.
    >
    > i still say try the design view, you see more happening there in front of
    > you without worry about strings of info...
    >
    > Dan.
    >
    > "John Giblin" <> wrote in message
    > news:...
    > > I just forgot that in that try. No affect. Still cannot connect. It

    > seems
    > > like a configuration on my mchine since it worked for someone else with

    > the
    > > same code
    > >
    > > John
    > > "Jon Yates" <> wrote in message
    > > news:00b401c34baa$90764760$...
    > > > Hello mate.
    > > >
    > > > In your connection string you may need to supply the
    > > > Username and Password to the Database. I've pasted in the
    > > > connection sring that I use from within a Windows App to
    > > > connection to a SQLServer 2000 DB.
    > > >
    > > > Hope it helps,
    > > >
    > > > Jon
    > > >
    > > > "Provider=sqloledb;data source=SUNWL19655\NetSDK;initial
    > > > catalog=Portal; user id=sa; password="
    > > >
    > > > >-----Original Message-----
    > > > >I have written both a asp.net and a console program where
    > > > I am trying to
    > > > >connection to a db.
    > > > >
    > > > >When I use the sqlconnection using vs.net 2003. I am able
    > > > to see the table
    > > > >and the test the connection
    > > > >
    > > > >When I run my program I get an error! ARGh!
    > > > >
    > > > >In my console program I get:
    > > > >Error Request for the permission of type
    > > > >System.Data.SqlClient.SqlClientPermission, System.Data,
    > > > Version=1.0.5000.0,
    > > > >Cul
    > > > >ture=neutral, PublicKeyToken=b77a5c561934e089 failed.
    > > > >
    > > > >In my asp.net i get this:
    > > > >Exception Details: System.UnauthorizedAccessException:
    > > > Access is denied.
    > > > >
    > > > >It fails at the open():
    > > > >Console program
    > > > >
    > > > >string strConnect = "workstation id=NYCNJGIBLIN;packet
    > > > size=4096;user
    > > > >id=jgiblin;data source=ewr1gpdsq" +
    > > > >
    > > > >"l;persist security info=False"; }
    > > > >
    > > > >SqlConnection conn = new SqlConnection(strConnect);
    > > > >
    > > > >SqlCommand cmd = new SqlCommand("Select * from
    > > > Content_Master", conn);
    > > > >
    > > > >// cmd.Connection = new SqlConnection(strConnect);
    > > > >
    > > > >// cmd.CommandText = "Content_Master_Update";
    > > > >
    > > > >cmd.CommandType = CommandType.Text;
    > > > >
    > > > >test = "Step 2";
    > > > >
    > > > >test = "Step 3";
    > > > >
    > > > >conn.Open();
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >.
    > > > >

    > >
    > >

    >
    >
     
    John Giblin, Jul 16, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Otis Mukinfus
    Replies:
    3
    Views:
    958
    Juan T. Llibre
    Jul 8, 2005
  2. Replies:
    3
    Views:
    40,659
    Roedy Green
    Nov 16, 2005
  3. Replies:
    2
    Views:
    326
  4. Mohsen Pahlevanzadeh

    Qt connect and first connect or unicode

    Mohsen Pahlevanzadeh, Sep 17, 2013, in forum: Python
    Replies:
    3
    Views:
    176
    Mohsen Pahlevanzadeh
    Sep 18, 2013
  5. Mohsen Pahlevanzadeh

    Re: Qt connect and first connect or unicode

    Mohsen Pahlevanzadeh, Sep 17, 2013, in forum: Python
    Replies:
    0
    Views:
    135
    Mohsen Pahlevanzadeh
    Sep 17, 2013
Loading...

Share This Page