locked
how to use database RRS feed

  • Question

  • User855711609 posted

    Hi

    i am starting a new website that is developed in asp.net using C#.

    The hosting provider uses MySQL as the database. when i upload my files on their server how will i connect to the database of the hosting server for my applications like user login, user creation.

    I am asking this because i think that i can only use the database provided by the hosting server for storing the user data like user details, login details etc.

    correct me if I am wrong

    Any help would be great.

    thanks in advance

    Friday, December 9, 2011 3:04 AM

All replies

  • User-362017084 posted

    No,

    You can use any other database provided by any other hosting server for storing the user data.

    What you need is the database server name or if it is on same machine then try using localhost

    also you need to create user along with database to access the same.

    Friday, December 9, 2011 3:21 AM
  • User1508394307 posted

    Usually, you can see all db-information at the hosting panel of your host account or it has been emailed to you when the account was created. If you can't find it, contact support regarding this.

    If you already have all login details, change your connection strings as per example.

    In the code

    <asp:SqlDataSource id="DataSource1" 
        SelectCommand="SELECT * FROM table1"
        ConnectionString="DRIVER={MySQL ODBC 3.51 Driver}; SERVER=myhost; PORT=3306; DATABASE=mydb; USER=myuser; PASSWORD='mypassword'; OPTION=0; "
    runat="server" ProviderName="System.Data.Odbc"/>

    In the web.config

    <connectionStrings>
    <add name="MySQLConnectionString" connectionString="server=myhost; user id=myuser; password=mypassword; database=mydb; pooling=false;"
    providerName="MySql.Data.MySqlClient" />
    </connectionStrings>
    Friday, December 9, 2011 3:25 AM
  • User13850534 posted

    For a quality .net hosting there always comes with mssql server database support for better management. If your hosting doesn't support mssql, I highly doubt the service quality.

    Saturday, December 10, 2011 2:44 AM