473,388 Members | 1,346 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,388 software developers and data experts.

<newbie> ODBC issues!

hi

asp.net 2.0

i've used connectionstrings like this one for my webproject:
connectionString="Server=Pdc1;Database=Testing;Int egrated
Security=false;User ID=tester;Pwd=hardtoguesspwd;" />

But now I need to change to using odbc as the webhosting company only
support odbc. So from my understanding I need to change my
connectionstring - specify what odbc profile to use.

In addition I wonder if I need to change my code for accessing the database:
public List<CarGetCars()
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("test_spGetCars", cn);
cmd.CommandType = CommandType.StoredProcedure;
cn.Open();
return GetCarCollectionFromReader(cmd.ExecuteReader());
}
}
(does that code looks okay for being used together with odbc?)

any suggestions?
Nov 12 '08 #1
3 1384
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:OT*************@TK2MSFTNGP03.phx.gbl...
I've used connectionstrings like this one for my webproject:
connectionString="Server=Pdc1;Database=Testing;Int egrated
Security=false;User ID=tester;Pwd=hardtoguesspwd;" />

But now I need to change to using ODBC as the webhosting company only
support ODBC.
Are you absolutely sure about that? Any ISP which supports ASP.NET 2.0 and
above and also supports SQL Server will almost certainly support
SqlConnection - it's difficult to imagine how they couldn't, as it's built
directly into the .NET Framework. For an ISP to support *only* ODBC these
days is almost unthinkable - do they still have any clients left? I would
check again, if I were you...
If it turns out that they do support only ODBC, then I would seriously
consider finding another ISP ASAP, as they clearly haven't a clue what
they're doing. Which ISP is it, AAMOI? Don't tell me it's GoDaddy...?
So from my understanding I need to change my connectionstring - specify
what ODBC profile to use.
Not necessarily - there are quite a few ways of using ODBC:
http://www.connectionstrings.com/?carrier=sqlserver2005
In addition I wonder if I need to change my code for accessing the
database:
You definitely do.
public List<CarGetCars()
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("test_spGetCars", cn);
cmd.CommandType = CommandType.StoredProcedure;
cn.Open();
return GetCarCollectionFromReader(cmd.ExecuteReader());
}
}
(Does that code looks okay for being used together with ODBC?)
No. The above code is using SqlConnection, i.e. the native .NET data
provider for SQL Server, which is what you should be using in an ideal
world.

If you absolutely must use ODBC, then you'll need to use the ODBC provider
objects e.g. OdbcConnection, OdbcCommand etc...
Any suggestions?
Move to a real ISP.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 12 '08 #2
They support DSN-less connections also, whatever that means

the ISP is servetheworld.no

Nov 12 '08 #3
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
They support DSN-less connections also, whatever that means
DSN-less connections are connections which don't use DSNs:
http://www.google.co.uk/search?sourc...ess+sql+server

Which probably means that they support OleDb. Again, difficult to see how
they couldn't...
The ISP is servetheworld.no
Do you already have an account with them? If so, do you already have a
database on that account.

If I were you, I'd just try it! Create a very simple database with one table
and see if you can do a SELECT * on it using your existing SqlConnection
code...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 12 '08 #4

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

Similar topics

129
by: Torbjørn Pettersen | last post by:
I've started cleaning up my HTML and implementing CSS. So far I've used FrontPage, but am switching over to DreamWeaver. Reading a bit on W3Schools.com and W3.org I see there are a lot of HTML...
3
by: | last post by:
I have been researching articles on google on how to create a simple RSS feed that sucks <title><blurb><link><date> out of a sql server 2000 database via an aspx page. I know it has to be pushed...
14
by: dananrg | last post by:
Been using the ODBC module for Python 2.1 (Win32) and had another question. When I return data from date columns, it's in a strange object form, e.g. <something or other> (don't have the output in...
2
by: Jeff | last post by:
hi asp.net 2.0 In a webpage I have a GridView displaying a collection of data. This collection of data is a collection of objects based on a custom class. where each object represent a record...
1
by: jobsjournal | last post by:
hi, i'm a newbie here. need help on how to make &lt; appear as &lt; and a&gt; appear as a&gt; without turning to the < and > sign, respectively. just for knowledge thanks jobs
1
by: Jeff | last post by:
hi asp.net 3.5 (project upgraded from asp.net 2.0). are using vwd2008 express now This is my first ajax attempt. The code below shows a TextBox and a ListBox. The idea I was trying to...
0
by: Jeff | last post by:
Hi I'm following this tutorial: http://dev.live.com/gadgets/sdk/docs/default.htm And downloaded that sample file. Now I've created a simple web gadget project on my own:. I just made a copy...
4
by: Jeff | last post by:
Hi asp.net 2.0 I'm trying to implement a HyperLinkField into my GridView.. The SqlDataSource returns a field which is paths to files (each row in the GridView should have link to a file). ...
3
by: Jeff | last post by:
hi I'm wondering how to open a web browser window in VS2008. I've created a simple windows Live Agent and just want to test it in the VS2008 before I deploy it... any ideas how to open a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.