How to connect to Sybase?

Posted on 2004-11-22
Medium Priority
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

Accepted Solution

abanup earned 200 total points
ID: 12642809
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: http://www.microsoft.com/data/

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: http://msdn.microsoft.com/downloads/default.asp?URL=/downloads/sample.asp?url=/MSDN-FILES/027/001/668/msdncompositedoc.xml

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

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

<%@ Page CompilerOptions='/R:"C:\Program Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.dll"' 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



 <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" />


Author Comment

ID: 12643048
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?

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

839 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