Connecting to mysql localhost

Last post 11-11-2009 11:31 AM by raghav_khunger. 4 replies.

Sort Posts:

  • Connecting to mysql localhost

    10-07-2009, 9:39 PM
    • Member
      27 point Member
    • new coder
    • Member since 06-16-2008, 6:09 PM
    • Posts 79

    I just used part 1 and part 2 of this tutorial and I did all the installation/configuration, but when I try to run my page, I get the following error:

    I cannot find any resolution, anyone? thanks.

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

    <body>
        <form id="form1" runat="server">
        <div>
            <table>
                <tr>
                    <td>Type of Property</td>
                    <td><asp:DropDownList runat="server" ID="DDLPropertyType" DataSourceID="ODSPropertyType"></asp:DropDownList></td>
                </tr>
            </table>
            <asp:ObjectDataSource runat="server" ID="ODSPropertyType" TypeName="DataAccess.DataReader" SelectMethod="GetPropertyTypes">
            </asp:ObjectDataSource>
        </div>
        </form>
    </body>

    namespace DataAccess
    {
        public class DataReader
        {

    public static DataSet GetPropertyTypes()
            {
                string connectionString = "server=localhost; user id=Developer; password=mypassword; database=mydatabase; pooling=false;";
                SqlConnection sqlConnection = new SqlConnection(connectionString);
                string queryString = "select * From propertytypes order by propertytypedescription";
                SqlDataAdapter dataAdapter = new SqlDataAdapter(queryString, sqlConnection);
                DataSet dsPropertyTypes = new DataSet();
                dataAdapter.Fill(dsPropertyTypes);
                return dsPropertyTypes;
            }

      }

    }



  • Re: Connecting to mysql localhost

    10-07-2009, 11:40 PM
    • All-Star
      22,266 point All-Star
    • vik20000in
    • Member since 12-30-2005, 6:02 AM
    • Kolkata
    • Posts 3,464
    • TrustedFriends-MVPs

    ou cannot connect to MYSQL with the help of SQL connection, You need MYSQL driver (available for free).


    Below find the link for Step by Stepguide for the same.

    http://www.15seconds.com/issue/050210.htm

    Vikram
    www.vikramlakhotia.com


    Please mark the answer if it helped you
  • Re: Connecting to mysql localhost

    10-08-2009, 7:40 AM
    • Member
      27 point Member
    • new coder
    • Member since 06-16-2008, 6:09 PM
    • Posts 79

    Thanks. That is the exact tutorial I used. I forgot to post it. I did every single step in that instruction. Even copied the dll files into my application's bin folder. Still not working.


  • Re: Connecting to mysql localhost

    11-07-2009, 1:18 AM
    • Member
      440 point Member
    • TinyPond
    • Member since 07-28-2002, 10:39 PM
    • North West USA
    • Posts 116

    try to create an odbc connection download the mysql odbc driver in control panel set up you connections and then select in in you sqldatasource.


    TinyPond
  • Re: Connecting to mysql localhost

    11-11-2009, 11:31 AM
    • All-Star
      18,854 point All-Star
    • raghav_khunger
    • Member since 08-18-2008, 8:25 AM
    • Delhi, India
    • Posts 3,449
    • TrustedFriends-MVPs
    Raghav CodeASP.NET Community | My Blog | jQuery Intellisense in Visual Studio 2008




    "Success doesn't come to you…you go to it."--Marva Collins

    "Failure is success if we learn from it." Malcolm Forbes

    "Success does not come to those who wait . . . and it does not wait for anyone to come to it." Anonymous


Page 1 of 1 (5 items)