locked
Converting from asp classic to asp.net RRS feed

  • Question

  • User640639332 posted

    im a contractor and im upgrading the system from asp to asp.net

     

    they have an online data base that is uning the postgres drivers and have no idea how to link to the database with the asp.net. the connection string that they use with the asp is as follows:

    ConnStrP = "Driver={PostgreSQL 64-Bit ODBC Drivers};Server=(the servers name);Port=5432;Database=(databases name);Uid=(user id);Pwd=(passowrd);"

     

    can anyone help me out with making a connection to this database using ASP.NET

     

    Thursday, November 25, 2010 11:42 PM

All replies

  • User-821857111 posted

    string ConnStrP = "Driver={PostgreSQL 64-Bit ODBC Drivers};Server=(the servers name);Port=5432;Database=(databases name);Uid=(user id);Pwd=(passowrd);";
    OdbcConnection conn = new OdbcConnection(ConnStrP);

    Or using VB:

    Dim ConnStrP As String = "Driver={PostgreSQL 64-Bit ODBC Drivers};Server=(the servers name);Port=5432;Database=(databases name);Uid=(user id);Pwd=(passowrd);"
    Dim conn As OdbcConnection = New OdbcConnection(ConnStrP)

    Friday, November 26, 2010 1:09 AM
  • User640639332 posted

    so r u saying that i have to do the connection using vb and not through the web config file? 

     

    Thanks for replying so quickly

     

    ill be able to let u know if it has worked in 2 days time wen i get bac to the office and all

    Friday, November 26, 2010 9:14 PM
  • User-821857111 posted

    so r u saying that i have to do the connection using vb and not through the web config file? 

    No. You could do it using the web config if you like: http://msdn.microsoft.com/en-us/library/ms178411.aspx




    Saturday, November 27, 2010 3:31 AM
  • User640639332 posted

     i still have no idea what im doing wrong because the error that i keep getting is that the keyword driver isnt supported and everywhere i look it says to use the keyword so im a little confused for how im going to get around this. currently i have this connection string in the config file

    <connectionstrings>

             <add name="conn" connectionString=" Driver={postgreSQL};server=servername:5432;database=databasesname;UID=usreid;Password=password"/>

    <connectionstrings>

     

    is this close to being right or what...thatks for your help once again

    Sunday, November 28, 2010 8:08 PM
  • User640639332 posted

    Just for anyone else reading this(doubt it thou) i have solved my problem by changing the way i was trying to do everything. In short it was annoying me with all that special binding and crap so i went over to using data readers and that work straight away and allowed me to do soo much mmore customization to the data and in the way that i set everything out.

    for further reading on it to save you time, here is the link for data readers and data sets

    http://www.techbaba.com/q/744-difference+dataset+datareader.aspx

    its about a million times better than anything else that i was trying to do so thats what im going to and staying with

    Tuesday, February 22, 2011 10:42 PM