473,395 Members | 1,608 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,395 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 1484
'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 I use Sql2005 express, the Data Source in...
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 sql2000. thanks kes
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 SERVER};SERVER=ibmdept;DATABASE=CY_20060208;UID=sa;PWD=111111; ...
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 attempting to build a simple class that displays a GIF. ...
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 , i'd like to use hosting service but this...
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 much the same as vb6 and SQL2000 DTS
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. I installed SQL 2005 as a named instance...
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 Microsoft.SqlServer.Management.Common; 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 have them all installed in D drive. My databases...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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:
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
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...
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.