How to connect to Sybase?

Posted on 2004-11-22
Last Modified: 2008-03-10
Have you ever connected to Sybase using ASP.NET? Could you show me your code?

To someone who have worked with Sybase Data warehouse: Is the code make connection to Database similar to Dara warehouse?


Question by:ehanoi2
    LVL 3

    Accepted Solution

    Follow following steps:

    1. Make sure you have installed the .Net Framework on your WebServer (IIS 5)

    2. Also make sure your Sybase Server has the latest MDAC version 2.7. You can get this upgrade at:

    3. You'll need to download the ODBC.Net Managed Provider (which by the way doesn't come with the .Net Framework). Install it on your web server. You can get this at:

    4. Go to your - C:\Program Files\Microsoft.NET\Odbc.Net\  on your web server, and make sure that the "" file lives there.

    5. Copy and paste this code into a new .aspx page.

    <%@ Page CompilerOptions='/R:"C:\Program Files\Microsoft.NET\Odbc.Net\"' Debug="True"%>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="Microsoft.Data.Odbc" %>


    <SCRIPT Language="VBScript" Runat="server">

    Sub Page_Load(Source as object, e as EventArgs)

     Dim strconn as String = "Driver={Sybase System 11};srvr=saintlucia;Database=mydb;UID=angel;PWD=kyrah;"
     Dim conn as ODBCConnection = new ODBCConnection(strconn)
     Dim strSQL as string = "SELECT * FROM tblMangoes"
     Dim query as ODBCDataAdapter = New ODBCDataAdapter(strSQL, conn)

     Dim ds as Dataset = new DataSet()

     myDataGrid.DataSource = ds

    End Sub

    </SCRIPT >


     <FONT COLOR="Blue" FACE="Verdana" SIZE="2">SELECT * FROM tblMangoes<BR><BR></FONT>
     <ASP:DataGrid ID="MyDataGrid" Runat="server" Font-Size="10pt" Font-Name="Verdana" />

    LVL 1

    Author Comment

    Thank abanup

    Have you ever worked with Sybase data warehouse? I've found the code connect to SQLServer data warehouse (using OLAP)
            ' Connect to the OLAP server
            Dim cn As New ADODB.Connection
            cn.Open("provider=msolap;data source=localhost")
            cn.DefaultDatabase = "Foodmart 2000"

    but cannot found the same code for Sybase data warehouse. Do you have one?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now