472,353 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Simple code worked fine with SQL2005, but now has a problem with SQL2000.

Hi. This code worked fine with SQL2005, but has a problem with
SQL2000.... Which one ????

cnSQL = New
SqlConnection(System.Configuration.ConfigurationMa nager.AppSettings("ConnectionString"))
cnSQL.Open()

fails with the error

"Format of the initialization string does not conform to specification
starting at index 0."

if in web.config I have

<!-- SQL2000, with Username/Password....-->
<add
key="ConnectionString"
value="Data Source='SQLDEV001\SQLDEV001;Initial Catalog='SOP';User
ID=SOP_DEV;Password=AAA;"
/>

and

<add
name="OrderingProcess"
connectionString="server='SQLDEV001\SQLDEV001';dat abase='SOP';User
ID=SOP_DEV;Password=AAA;"
providerName="System.Data.SqlClient"
/>

which is used in some page as:

<asp:SqlDataSource
ID="LocationSqlDataSource"
SelectCommand="SELECT
Measures.[Measure ID] as ID,
Measures.[Measure Description] as Measure,
Locations_BY_Measure.[Locations] as Location
FROM Locations_BY_Measure INNER JOIN Measures
ON Locations_BY_Measure.[Measure ID] = Measures.[Measure ID]"
EnableCaching="True"
ConnectionString="<%$ ConnectionStrings:OrderingProcess %>"
CacheDuration="60"
FilterExpression="ID = {0}"
RunAt="server">
while the exact same code works great with the 2005 settings:

<!-- SQL2005, with Username/Password....-->
<add
key="ConnectionString"
value="Data Source='myOtherComputer\SQLEXPRESS';Initial
Catalog='SOP';User ID=SOP_DEV;Password=AAA;"
/>

and

<add
name="OrderingProcess"
connectionString="server='SQLDEV001\SQLDEV001';dat abase='SOP';User
ID=SOP_DEV;Password=AAA;"
providerName="System.Data.SqlClient" />

Of course, using Enterprise Manager I can connect using the SOP_DEV
and AAA info to both databases.

Could you help me, please ?

Thanks, Alex.

May 7 '07 #1
8 1438
'SOP' - try removing the single quotes.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Radu" wrote:
Hi. This code worked fine with SQL2005, but has a problem with
SQL2000.... Which one ????

cnSQL = New
SqlConnection(System.Configuration.ConfigurationMa nager.AppSettings("ConnectionString"))
cnSQL.Open()

fails with the error

"Format of the initialization string does not conform to specification
starting at index 0."

if in web.config I have

<!-- SQL2000, with Username/Password....-->
<add
key="ConnectionString"
value="Data Source='SQLDEV001\SQLDEV001;Initial Catalog='SOP';User
ID=SOP_DEV;Password=AAA;"
/>

and

<add
name="OrderingProcess"
connectionString="server='SQLDEV001\SQLDEV001';dat abase='SOP';User
ID=SOP_DEV;Password=AAA;"
providerName="System.Data.SqlClient"
/>

which is used in some page as:

<asp:SqlDataSource
ID="LocationSqlDataSource"
SelectCommand="SELECT
Measures.[Measure ID] as ID,
Measures.[Measure Description] as Measure,
Locations_BY_Measure.[Locations] as Location
FROM Locations_BY_Measure INNER JOIN Measures
ON Locations_BY_Measure.[Measure ID] = Measures.[Measure ID]"
EnableCaching="True"
ConnectionString="<%$ ConnectionStrings:OrderingProcess %>"
CacheDuration="60"
FilterExpression="ID = {0}"
RunAt="server">
while the exact same code works great with the 2005 settings:

<!-- SQL2005, with Username/Password....-->
<add
key="ConnectionString"
value="Data Source='myOtherComputer\SQLEXPRESS';Initial
Catalog='SOP';User ID=SOP_DEV;Password=AAA;"
/>

and

<add
name="OrderingProcess"
connectionString="server='SQLDEV001\SQLDEV001';dat abase='SOP';User
ID=SOP_DEV;Password=AAA;"
providerName="System.Data.SqlClient" />

Of course, using Enterprise Manager I can connect using the SOP_DEV
and AAA info to both databases.

Could you help me, please ?

Thanks, Alex.

May 7 '07 #2

www.connectionstrings.com has all the syntaxes.

be anal about spaces semi colons and single quotes.


"Radu" <cu*************@yahoo.comwrote in message
news:11**********************@h2g2000hsg.googlegro ups.com...
Hi. This code worked fine with SQL2005, but has a problem with
SQL2000.... Which one ????

cnSQL = New
SqlConnection(System.Configuration.ConfigurationMa nager.AppSettings("Connect
ionString"))
cnSQL.Open()

fails with the error

"Format of the initialization string does not conform to specification
starting at index 0."

if in web.config I have

<!-- SQL2000, with Username/Password....-->
<add
key="ConnectionString"
value="Data Source='SQLDEV001\SQLDEV001;Initial Catalog='SOP';User
ID=SOP_DEV;Password=AAA;"
/>

and

<add
name="OrderingProcess"
connectionString="server='SQLDEV001\SQLDEV001';dat abase='SOP';User
ID=SOP_DEV;Password=AAA;"
providerName="System.Data.SqlClient"
/>

which is used in some page as:

<asp:SqlDataSource
ID="LocationSqlDataSource"
SelectCommand="SELECT
Measures.[Measure ID] as ID,
Measures.[Measure Description] as Measure,
Locations_BY_Measure.[Locations] as Location
FROM Locations_BY_Measure INNER JOIN Measures
ON Locations_BY_Measure.[Measure ID] = Measures.[Measure ID]"
EnableCaching="True"
ConnectionString="<%$ ConnectionStrings:OrderingProcess %>"
CacheDuration="60"
FilterExpression="ID = {0}"
RunAt="server">
while the exact same code works great with the 2005 settings:

<!-- SQL2005, with Username/Password....-->
<add
key="ConnectionString"
value="Data Source='myOtherComputer\SQLEXPRESS';Initial
Catalog='SOP';User ID=SOP_DEV;Password=AAA;"
/>

and

<add
name="OrderingProcess"
connectionString="server='SQLDEV001\SQLDEV001';dat abase='SOP';User
ID=SOP_DEV;Password=AAA;"
providerName="System.Data.SqlClient" />

Of course, using Enterprise Manager I can connect using the SOP_DEV
and AAA info to both databases.

Could you help me, please ?

Thanks, Alex.

May 7 '07 #3
On May 7, 8:02 pm, Radu <cuca_macaii2...@yahoo.comwrote:
>
<!-- SQL2000, with Username/Password....-->
<add
key="ConnectionString"
value="Data Source='SQLDEV001\SQLDEV001;Initial Catalog='SOP';User
ID=SOP_DEV;Password=AAA;"
/>

and

<add
name="OrderingProcess"
connectionString="server='SQLDEV001\SQLDEV001';dat abase='SOP';User
ID=SOP_DEV;Password=AAA;"
providerName="System.Data.SqlClient"
/>
they are the same strings, why the syntax is different?

I've tried to connect using such strings to my local SQL 2000 server
and I have no problem with quotes.

Alex, what about the named instance? Are you sure about the name?

May 7 '07 #4
On May 7, 3:07 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On May 7, 8:02 pm, Radu <cuca_macaii2...@yahoo.comwrote:


<!-- SQL2000, with Username/Password....-->
<add
key="ConnectionString"
value="Data Source='SQLDEV001\SQLDEV001;Initial Catalog='SOP';User
ID=SOP_DEV;Password=AAA;"
/>
and
<add
name="OrderingProcess"
connectionString="server='SQLDEV001\SQLDEV001';dat abase='SOP';User
ID=SOP_DEV;Password=AAA;"
providerName="System.Data.SqlClient"
/>

they are the same strings, why the syntax is different?

I've tried to connect using such strings to my local SQL 2000 server
and I have no problem with quotes.

Alex, what about the named instance? Are you sure about the name?- Hide quoted text -

- Show quoted text -

Hi. Finally.... it works.... Hmmmmmmm..... I took out all quotes, thus
the string (working for 2005)

<add name="OrderingProcess"
connectionString="server='C227226\SQLEXPRESS';data base='SOP';User
ID=SOP_DEV;Password=AAA;" providerName="System.Data.SqlClient" />

became for 2000

<add name="OrderingProcess"
connectionString="server=SQLDEV001\SQLDEV001;datab ase=SOP;User
ID=SOP_DEV;Password=AAA;" providerName="System.Data.SqlClient" />

Note that the string (otherwise correct, from a 2005 standpoint)

<add name="OrderingProcess"
connectionString="server='SQLDEV001\SQLDEV001';dat abase='SOP';User
ID=SOP_DEV;Password=AAA;" providerName="System.Data.SqlClient" />

with single quotes did *NOT* work, so, to make it work,
'SOP'
became
SOP
and
'SQLDEV001\SQLDEV001'
became
SQLDEV001\SQLDEV001

Very strange, indeed.... looks like the strings are parsed
differently.... Again, as I was saying, Hmmmmmmmm......

I lost almost a whole morning fighting this problem !
Anyway, it works now. Thank you all very much for your kind
answers :-)))))

Alex.

May 7 '07 #5
On May 7, 10:53 pm, Radu <cuca_macaii2...@yahoo.comwrote:
>
Hi. Finally.... it works.... Hmmmmmmm..... I took out all quotes, thus
the string (working for 2005)

<add name="OrderingProcess"
connectionString="server='C227226\SQLEXPRESS';data base='SOP';User
ID=SOP_DEV;Password=AAA;" providerName="System.Data.SqlClient" />

became for 2000

<add name="OrderingProcess"
connectionString="server=SQLDEV001\SQLDEV001;datab ase=SOP;User
ID=SOP_DEV;Password=AAA;" providerName="System.Data.SqlClient" />

Note that the string (otherwise correct, from a 2005 standpoint)

<add name="OrderingProcess"
connectionString="server='SQLDEV001\SQLDEV001';dat abase='SOP';User
ID=SOP_DEV;Password=AAA;" providerName="System.Data.SqlClient" />

with single quotes did *NOT* work, so, to make it work,
'SOP'
became
SOP
and
'SQLDEV001\SQLDEV001'
became
SQLDEV001\SQLDEV001

Very strange, indeed.... looks like the strings are parsed
differently.... Again, as I was saying, Hmmmmmmmm......

I lost almost a whole morning fighting this problem !
Anyway, it works now. Thank you all very much for your kind
answers :-)))))

Alex.
I don't get it.

The following code (using single quotes) works for me:

<asp:GridView ID="GridView1" DataSourceID="SqlDataSource1"
runat="server" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand="SELECT ... FROM ..."
ConnectionString="Data Source='localhost';Initial
Catalog='databasename';User ID=sa;Password=pass;" />

as well as:

<asp:GridView ID="GridView1" DataSourceID="SqlDataSource1"
runat="server" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand="SELECT ... FROM ... "
ConnectionString="<%$ ConnectionStrings:OrderingProcess %>" />

in web.config

<connectionStrings>
<add name="OrderingProcess"
connectionString="Data Source='localhost';Initial
Catalog='databasename';User ID=sa;Password=pass;"
providerName="System.Data.SqlClient" />
</connectionStrings>

--ASP.NET 2.0, SQL 2000

where is the difference?

May 7 '07 #6
The connection string name=value pairs do not take 'quotation' marks. Unless
of course your database name really is 'SOP' instead of SOP.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Radu" wrote:
On May 7, 3:07 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On May 7, 8:02 pm, Radu <cuca_macaii2...@yahoo.comwrote:


<!-- SQL2000, with Username/Password....-->
<add
key="ConnectionString"
value="Data Source='SQLDEV001\SQLDEV001;Initial Catalog='SOP';User
ID=SOP_DEV;Password=AAA;"
/>
and
<add
name="OrderingProcess"
connectionString="server='SQLDEV001\SQLDEV001';dat abase='SOP';User
ID=SOP_DEV;Password=AAA;"
providerName="System.Data.SqlClient"
/>
they are the same strings, why the syntax is different?

I've tried to connect using such strings to my local SQL 2000 server
and I have no problem with quotes.

Alex, what about the named instance? Are you sure about the name?- Hide quoted text -

- Show quoted text -


Hi. Finally.... it works.... Hmmmmmmm..... I took out all quotes, thus
the string (working for 2005)

<add name="OrderingProcess"
connectionString="server='C227226\SQLEXPRESS';data base='SOP';User
ID=SOP_DEV;Password=AAA;" providerName="System.Data.SqlClient" />

became for 2000

<add name="OrderingProcess"
connectionString="server=SQLDEV001\SQLDEV001;datab ase=SOP;User
ID=SOP_DEV;Password=AAA;" providerName="System.Data.SqlClient" />

Note that the string (otherwise correct, from a 2005 standpoint)

<add name="OrderingProcess"
connectionString="server='SQLDEV001\SQLDEV001';dat abase='SOP';User
ID=SOP_DEV;Password=AAA;" providerName="System.Data.SqlClient" />

with single quotes did *NOT* work, so, to make it work,
'SOP'
became
SOP
and
'SQLDEV001\SQLDEV001'
became
SQLDEV001\SQLDEV001

Very strange, indeed.... looks like the strings are parsed
differently.... Again, as I was saying, Hmmmmmmmm......

I lost almost a whole morning fighting this problem !
Anyway, it works now. Thank you all very much for your kind
answers :-)))))

Alex.

May 7 '07 #7
Hi Alex,

just to add to the other posters: Unless it's a typo, the first
connection string is missing the closing quotation mark after the
instance name (apart from the fact that you don't need quotation marks).

Radu wrote:
<add
key="ConnectionString"
value="Data Source='SQLDEV001\SQLDEV001;Initial Catalog='SOP';User
ID=SOP_DEV;Password=AAA;"
/>
Roland
May 8 '07 #8
On May 8, 8:00 am, Roland Dick <bris...@web.dewrote:
Hi Alex,

just to add to the other posters: Unless it's a typo, the first
connection string is missing the closing quotation mark after the
instance name (apart from the fact that you don't need quotation marks).

Radu wrote:
<add
key="ConnectionString"
value="Data Source='SQLDEV001\SQLDEV001;Initial Catalog='SOP';User
ID=SOP_DEV;Password=AAA;"
/>

Roland


Hi, all.

It's true, and it's strange. The same string worked great in 2005, but
stopped working with the above-mentioned error in 2000 (of course, I
have changed the name of the instance to match). At least this is the
way it behaved on my computer at work - I'm curious to test it at
home. Anyway, it all works now (without any quotation marks), and
that's what counts - I already forgot this aggravation, like so many
others :-))))))) This is the nature of this beast, I guess.

Thank you all for spending the time reading this. I honestly
appreciate it !

Alex.

PS. Yes, Roland, it was a typo :-)

May 9 '07 #9

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

Similar topics

2
by: ad | last post by:
The user of my asp.net program use Sql2005 or Sql2005 express as database, both are possible. I have try both version of data base, I found: If...
2
by: WebBuilder451 | last post by:
I'd like to know if anyone here is using the betas in a light production environment and how usable thay are. Also if anyone is using 2.0 and...
1
by: Benny Ng | last post by:
The error is shown by the following connection string.£¨But it can be runs properly in SQL2000£© PROVIDER=MSDATASHAPE;DRIVER={SQL...
4
by: john.orlando | last post by:
Hello, I'm a newbie to Python (literally, within the last two weeks), and I am playing around with Tkinter to build some simple GUIs. I am...
2
by: PointMan | last post by:
i make a project in vs2005 that use ASPNETDB.MDF and use <asp:LoginView ID="LoginView1" runat="server" > server control for vs2005 in this case...
1
by: Peter Newman | last post by:
Im looking for a working modal / example on how to execute a business object package on a 2005 server from vb.net ( 2003) , parming in parameters ...
5
by: Mike | last post by:
I'm having trouble accessing SQL2005 Standard Edition as a second instance of SQL Server where the first instance is SQL 2000 Enterprise Edition. ...
7
by: Olegus | last post by:
Hello, in order to perform backup/restore MSSQL database using SMO, one needs to reference several namespaces in a backup class : using...
0
by: nic829 | last post by:
Hi, I was upgrading a instance from SQL2000 to SQL2005. During SQL2005 setup I accidently allow the files to be installed in C drive, but I should...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.