.NETGURU
Sybase Database Connection
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-odbc' list.


A Vohra
-- Moved from [aspngfreeforall] to [ngfx-odbc] by Marcie Jones <Click here to reveal e-mail address> --

Hi All

I'm trying to connect to Sybase Database Using asp.net. I need samplecode if possiable Also I'm Calling SP to retrive data.

Arif
Click here to reveal e-mail address

--
__________________________________________________________

Sign-up for your own FREE Personalized E-mail at Mail.com

http://www.mail.com/?sr=signup

Save up to $160 by signing up for NetZero Platinum Internet service.

http://www.netzero.net/?refcd=N2P0602NEP8

Reply to this message...
 
    
=?iso-8859-1?Q?Jonathan_Hjertstr=F6m?=
Hi,

I am using Sybase ASA 6.0 and it works fine. You have to use the =
Microsoft ODBC drivers for .Net.

I then make a System DSN and that works fine. This is how my connection =
string looks like in webconfig.

<add key=3D"OdbcConnection.ConnectionString" =
value=3D"DSN=3DMISJudic;UID=3Ddba;PWD=3Dsql;" />

And here is some code to look at:

Dim MyConnection As OdbcConnection =3D New =
OdbcConnection(ConfigurationSettings.AppSettings("OdbcConnection.Connecti=
onString"))

Dim myCommand As OdbcCommand =3D New OdbcCommand(SQLString, =
MyConnection)

Dim myDataReader As OdbcDataReader

Try
MyConnection.Open()

myDataReader =3D =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)

'Setting the default values if any
If Len(DefaultStartValueText) <> 0 Then
ddlName.DataValueField.Insert(0, DefaultStartValue)
ddlName.DataTextField.Insert(0, =
DefaultStartValueText)
End If
'Setting the actual values if any
ddlName.DataValueField =3D DataValueField
ddlName.DataTextField =3D DataTextField

ddlName.DataSource =3D myDataReader
ddlName.SelectedIndex =3D 0
ddlName.DataBind()

Catch myException As Exception
'Response.Write("An error has occurred: " & =
myException.ToString())
Finally
If Not myDataReader Is Nothing Then
myDataReader.Close()
End If
End Try

Hope it helps to get you started. Sorry I don't have any code for sp.

Regards,

Jonathan Hjertstr=F6m
-----Original Message-----
From: A Vohra [mailto:Click here to reveal e-mail address]=20
Sent: den 9 juli 2002 00:04
To: ngfx-odbc
Subject: [ngfx-odbc] Sybase Database Connection

-- Moved from [aspngfreeforall] to [ngfx-odbc] by Marcie Jones =
<Click here to reveal e-mail address> --

Hi All

I'm trying to connect to Sybase Database Using asp.net. I need =
samplecode if possiable Also I'm Calling SP to retrive data.=20

Arif
Click here to reveal e-mail address

--=20
__________________________________________________________

Sign-up for your own FREE Personalized E-mail at Mail.com

http://www.mail.com/?sr=3Dsignup

Save up to $160 by signing up for NetZero Platinum Internet service.

http://www.netzero.net/?refcd=3DN2P0602NEP8

| [ngfx-odbc] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-odbc.asp =3D JOIN/QUIT

Reply to this message...
 
    
Quale, Michael
You can also load the Sybase ASE OLE Provider and connect using OLE in =
.NET.

MQ

-----Original Message-----
From: Jonathan Hjertstr=F6m [mailto:Click here to reveal e-mail address]
Sent: Tuesday, July 09, 2002 1:15 AM
To: ngfx-odbc
Subject: [ngfx-odbc] RE: Sybase Database Connection

Hi,

I am using Sybase ASA 6.0 and it works fine. You have to use the =
Microsoft
ODBC drivers for .Net.

I then make a System DSN and that works fine. This is how my connection
string looks like in webconfig.

<add key=3D"OdbcConnection.ConnectionString"
value=3D"DSN=3DMISJudic;UID=3Ddba;PWD=3Dsql;" />

And here is some code to look at:

Dim MyConnection As OdbcConnection =3D New
OdbcConnection(ConfigurationSettings.AppSettings("OdbcConnection.Connect=
ionS
tring"))

Dim myCommand As OdbcCommand =3D New OdbcCommand(SQLString,
MyConnection)

Dim myDataReader As OdbcDataReader

Try
MyConnection.Open()

myDataReader =3D
myCommand.ExecuteReader(CommandBehavior.CloseConnection)

'Setting the default values if any
If Len(DefaultStartValueText) <> 0 Then
ddlName.DataValueField.Insert(0, DefaultStartValue)
ddlName.DataTextField.Insert(0, =
DefaultStartValueText)
End If
'Setting the actual values if any
ddlName.DataValueField =3D DataValueField
ddlName.DataTextField =3D DataTextField

ddlName.DataSource =3D myDataReader
ddlName.SelectedIndex =3D 0
ddlName.DataBind()

Catch myException As Exception
'Response.Write("An error has occurred: " &
myException.ToString())
Finally
If Not myDataReader Is Nothing Then
myDataReader.Close()
End If
End Try

Hope it helps to get you started. Sorry I don't have any code for sp.

Regards,

Jonathan Hjertstr=F6m
-----Original Message-----
From: A Vohra [mailto:Click here to reveal e-mail address]=20
Sent: den 9 juli 2002 00:04
To: ngfx-odbc
Subject: [ngfx-odbc] Sybase Database Connection

-- Moved from [aspngfreeforall] to [ngfx-odbc] by Marcie Jones
<Click here to reveal e-mail address> --

Hi All

I'm trying to connect to Sybase Database Using asp.net. I need =
samplecode if
possiable Also I'm Calling SP to retrive data.=20

Arif
Click here to reveal e-mail address

--=20
__________________________________________________________

Sign-up for your own FREE Personalized E-mail at Mail.com

http://www.mail.com/?sr=3Dsignup

Save up to $160 by signing up for NetZero Platinum Internet service.

http://www.netzero.net/?refcd=3DN2P0602NEP8

| [ngfx-odbc] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-odbc.asp =3D JOIN/QUIT

| [ngfx-odbc] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-odbc.asp =3D JOIN/QUIT

Reply to this message...
 
 
System.Configuration.ConfigurationSettings
System.Data.CommandBehavior
System.Data.Odbc.OdbcCommand
System.Data.Odbc.OdbcConnection
System.Data.Odbc.OdbcDataReader




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification