How to connect to Sybase?

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?

Thanks

ehanoi
LVL 1
ehanoi2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

abanupCommented:
Hi
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" %>

<HTML>
<HEAD>

<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()
 query.fill(ds)

 myDataGrid.DataSource = ds
 myDataGrid.DataBind()

End Sub

</SCRIPT >

</HEAD>
<BODY>

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

</BODY>
</HTML>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ehanoi2Author Commented:
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?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.