connection string help

Last post 05-12-2008 2:14 AM by aloksinha83@gmail.com. 5 replies.

Sort Posts:

  • connection string help

    05-06-2008, 1:00 PM
    • Loading...
    • snovice
    • Joined on 01-25-2008, 2:05 PM
    • Posts 120

    Hello all,

    Please help me as i am not able to connect to my database

    i have my databse in datab directory

    and this is my connection string

    <add name="Connstrmy" connectionString="my server ; AttachDbFilename=&quot;datadirectory\test.mdf&quot;;uid=username; pwd=passowrd;"

    providerName="System.Data.SqlClient" />

     

    hosting people have said that you are using uid and password for databse and not of server

    i have to add user id and password for server also

    how do i do that?

    is user id=uid

    pwd=password?

    please help me
  • Re: connection string help

    05-06-2008, 1:12 PM
    • Loading...
    • mfouwaaz
    • Joined on 10-03-2007, 6:43 PM
    • Vancouver, Canada
    • Posts 232

    The hosting people need to give you details about how to create a database and create a user  name and password.

     The connection string should look something like this.

     <connectionStrings>
        <remove name="LocalSqlServer" />
        <add name="LocalSqlServer" connectionString="Data Source=<IP ADDRESS AND PORT OF SERVER>;initial catalog=<NAME OF DATABASE>; user ID=<USER NAME>; password=<PASSWORD>"  providerName="System.Data.SqlClient" />
    </connectionStrings>

     Hope this helps.

    Somewhere, something incredible is waiting to be known -- Carl Sagan

    http://www.figwire.com
  • Re: connection string help

    05-11-2008, 11:15 PM
    Answer

    snovice:

    hosting people have said that you are using uid and password for databse and not of server

    i have to add user id and password for server also

    how do i do that?

    As far as I can see, there is no userid or password for a specific database, since sql authentication is designed for sql database engine (not a particular database),  all the user id and password are for the database server. I think generally speaking your connection string seems fine to me, except I noticed that you are using Auto Attachment -- in this case you need to make sure that the server you are connecting to is a Sql Express and also the database file (*.mdf) is accessible from the server side (the path you have provided should be the "server path",i.e, the file is resided in the server side). Hope my suggestion helps

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: connection string help

    05-12-2008, 1:04 AM
    • Loading...
    • snovice
    • Joined on 01-25-2008, 2:05 PM
    • Posts 120

     

    Thanks you sir,

    path is server path which they have provided me.

    attachdbfilename, database, initialcatalog  i have tried everything.

    no on host what i have been informed that they are providing me with sql 2005 thats it no more information.

    when i use attachdb filename thne i get error mesagecan attach database to...

    when i use database or intial catalog error i get is

    login failed for databasename.mdf 

    so what could be the issue.

    thanks you sir,


     

  • Re: connection string help

    05-12-2008, 2:00 AM
    Answer

    snovice:

    no on host what i have been informed that they are providing me with sql 2005 thats it no more information.

    when i use attachdb filename thne i get error mesagecan attach database to...

    when i use database or intial catalog error i get is

    login failed for databasename.mdf 

    Since the server side database engine is sql2005, not express, you cannot use Auto-Attach Database files.

    ConnectionString format should be like this:  "Data Source=Server_Ip;Initial Catalog=The_DAtabase_you_want_to _Access;uid=username; pwd=passowrd"
       providerName="System.Data.SqlClient"

    Also, as to the "login failed for databasename" problem, it indicates that the sql userid/password you have provided is not valid. So you need to apply for a new one from your web host company.

    Hope my suggestion helps

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: connection string help

    05-12-2008, 2:14 AM
    Answer

     Hi,

    u can go through this link - http://www.connectionstrings.com/?carrier=sqlserver2005

    for ur query. 

    Alok
Page 1 of 1 (6 items)