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




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com