473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Connection with sql server 2000 using DSN

Dear all i want to make connection with database using DNS i am trying
it in followin way but it gives me an error keyword not suppoerted dsn

can any one tell me what is the problem with in it.
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if(!Page.IsPostBack)
{
SqlConnection cn =new SqlConnection();
SqlCommand cmd=new SqlCommand();
SqlDataAdapter da =new SqlDataAdapter();
DataSet ds =new DataSet();
cn.ConnectionString="DSN=TestDSN;Uid=sa;Pwd=sa";
cn.Open();
cmd.Connection=cn;
cmd.CommandText="select * from statemaster";
da.SelectCommand=cmd;
da.Fill(ds,"statemaster");
DataGrid1.DataSource=ds.Tables[0].DefaultView;
DataGrid1.DataBind();

}
}
here is web confing file code
<appSettings>
<add key="CnnString" value="DSN=TestDSN;Uid=sa;Pwd=sa" />
</appSettings>

any help greately apreciated.

Sep 25 '06 #1
1 1316
Silly question - the "TestDSN" DSN is set up correctly?

--
Barny
"santosh" wrote:
Dear all i want to make connection with database using DNS i am trying
it in followin way but it gives me an error keyword not suppoerted dsn

can any one tell me what is the problem with in it.
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if(!Page.IsPostBack)
{
SqlConnection cn =new SqlConnection();
SqlCommand cmd=new SqlCommand();
SqlDataAdapter da =new SqlDataAdapter();
DataSet ds =new DataSet();
cn.ConnectionString="DSN=TestDSN;Uid=sa;Pwd=sa";
cn.Open();
cmd.Connection=cn;
cmd.CommandText="select * from statemaster";
da.SelectCommand=cmd;
da.Fill(ds,"statemaster");
DataGrid1.DataSource=ds.Tables[0].DefaultView;
DataGrid1.DataBind();

}
}
here is web confing file code
<appSettings>
<add key="CnnString" value="DSN=TestDSN;Uid=sa;Pwd=sa" />
</appSettings>

any help greately apreciated.

Sep 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dave Dudley | last post by:
Hi, I have a new ASP .Net project that has been developed on our development machine and connects to SQL Server 2000 on the same machine. It is connecting via a connection string similiar to:...
7
by: Keith Norris | last post by:
I cannot successfully create a connection object in a web form. In the page_load event I try the following code: Dim sConnection As String = "server=MIDATLANTICUS;" & _ database=Pubs;integrated...
16
by: peshekeedweller | last post by:
Using asp.net 1.1. vb.net 2003. I am trying to connect to a remote sql server 2000 on a virtual machine running windows 2000 server. I can connect through the server explorer in visual studio,...
1
by: vighnesh | last post by:
Hi All I am dealing a project in ASP.NET in which I have to establish a connection to SQL Server 2000 database,where the database was located on a remote system. For this I have used...
18
by: Jon Delano | last post by:
Hey all I am building a new computer. I have Windows XP Pro with SP2 and all the updates. I installed VS 2003. Then copied a project from my old computer to the new one. When I try and run...
26
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On...
17
by: Danieltbt05 | last post by:
just installed SQL server 2000 and using my client , i can't locate the server. I used SQL query analyzer to search but no servers were found. Error message is as below Server : Msg17,level...
2
by: hfk0 | last post by:
Hi, I have a simple asp.net application running ok on my WinXP development server with SQL Server Express 2005 installed locally. After moving to the live server (Win 2000 server with MSDE 2000...
5
by: OJ | last post by:
Hi, I am at a loss here, I have a c# asp.net website which connects to a remote SQL Server 2000 db via a connection string. If I set the website up in the filesystem and use the inbuilt cassini...
2
borisding
by: borisding | last post by:
Hi all, I have recently migrated ASP application from Windows server 2000 to 2003. But failed to connect to SQL Server 2000. (Both sql server and application are on the same server) I keep...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.