PC Review


Reply
Thread Tools Rate Thread

dataadapter wizard connection string

 
 
=?Utf-8?B?am9obiBzbWl0aGVycw==?=
Guest
Posts: n/a
 
      5th Sep 2004
I'm trying to modify the connection string made by the dataadapter wizard to
a relative path. My current datasource is this:

""C:\Inetpub\wwwroot\database\database.mdb""

How can i change so when its on the server it will look for the directory
"database" in the root of the virtual directory?


cheers
 
Reply With Quote
 
 
 
 
Greg Burns
Guest
Posts: n/a
 
      5th Sep 2004
Dim cn As OleDb.OleDbConnection

cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath(ConfigurationSettings.AppSettings("path"))) ' -->>>
c:\inetpub\wwwroot\global\data\project1.mdb

web.config...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="path" value="/global/data/project1.mdb" />
</appSettings>

<system.web>
.... etc

HTH,
Greg

"john smithers" <(E-Mail Removed)> wrote in message
news:8E6CC9A6-1A01-4427-9957-(E-Mail Removed)...
> I'm trying to modify the connection string made by the dataadapter wizard

to
> a relative path. My current datasource is this:
>
> ""C:\Inetpub\wwwroot\database\database.mdb""
>
> How can i change so when its on the server it will look for the directory
> "database" in the root of the virtual directory?
>
>
> cheers



 
Reply With Quote
 
=?Utf-8?B?am9obiBzbWl0aGVycw==?=
Guest
Posts: n/a
 
      5th Sep 2004
thx for the reply but i'm looking at the "web form designer generated code"
and have found the oledbdataconnections and just want to modify this. What
i'm really having problem with is the syntax.

'
'OleDbConnection1
'
Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial
Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDBatabase L" & _
"ocking Mode=0;Data
Source=""C:\Inetpub\wwwroot\db\database.mdb"";Jet OLEDB:Engine " & _
"Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System
database=;Jet OLEDB:S" & _
"FP=False;persist security info=False;Extended
Properties=;Mode=Share Deny None;J" & _
"et OLEDB:Encrypt Database=False;Jet OLEDB:Create System
Database=False;Jet OLEDB" & _
"on't Copy Locale on Compact=False;Jet OLEDB:Compact Without
Replica Repair=Fal" & _
"se;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1"


Data source - i need to change to a relative path like
server.mappath(/database/database.mdb) but everything i've tried keeps
bringing up syntax errors.

















"Greg Burns" wrote:

> Dim cn As OleDb.OleDbConnection
>
> cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> Server.MapPath(ConfigurationSettings.AppSettings("path"))) ' -->>>
> c:\inetpub\wwwroot\global\data\project1.mdb
>
> web.config...
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <appSettings>
> <add key="path" value="/global/data/project1.mdb" />
> </appSettings>
>
> <system.web>
> .... etc
>
> HTH,
> Greg
>
> "john smithers" <(E-Mail Removed)> wrote in message
> news:8E6CC9A6-1A01-4427-9957-(E-Mail Removed)...
> > I'm trying to modify the connection string made by the dataadapter wizard

> to
> > a relative path. My current datasource is this:
> >
> > ""C:\Inetpub\wwwroot\database\database.mdb""
> >
> > How can i change so when its on the server it will look for the directory
> > "database" in the root of the virtual directory?
> >
> >
> > cheers

>
>
>

 
Reply With Quote
 
Greg Burns
Guest
Posts: n/a
 
      5th Sep 2004
Changing the desinger generated code is asking for trouble. The designer
will just overwrite it again when you least expect it.

Greg

'OleDbConnection1
'
Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial
Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDBatabase L" & _
"ocking Mode=0;Data
Source=" & Server.MapPath("/db/database.mdb") & ";Jet OLEDB:Engine " & _
"Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System
database=;Jet OLEDB:S" & _
"FP=False;persist security info=False;Extended
Properties=;Mode=Share Deny None;J" & _
"et OLEDB:Encrypt Database=False;Jet OLEDB:Create System
Database=False;Jet OLEDB" & _
"on't Copy Locale on Compact=False;Jet OLEDB:Compact Without
Replica Repair=Fal" & _
"se;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1"


"john smithers" <(E-Mail Removed)> wrote in message
news:00580164-8444-4EF5-83A2-(E-Mail Removed)...
> thx for the reply but i'm looking at the "web form designer generated

code"
> and have found the oledbdataconnections and just want to modify this. What
> i'm really having problem with is the syntax.
>
> '
> 'OleDbConnection1
> '
> Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial
> Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDBatabase L" & _
> "ocking Mode=0;Data
> Source=""C:\Inetpub\wwwroot\db\database.mdb"";Jet OLEDB:Engine " & _
> "Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System
> database=;Jet OLEDB:S" & _
> "FP=False;persist security info=False;Extended
> Properties=;Mode=Share Deny None;J" & _
> "et OLEDB:Encrypt Database=False;Jet OLEDB:Create System
> Database=False;Jet OLEDB" & _
> "on't Copy Locale on Compact=False;Jet OLEDB:Compact Without
> Replica Repair=Fal" & _
> "se;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1"
>
>
> Data source - i need to change to a relative path like
> server.mappath(/database/database.mdb) but everything i've tried keeps
> bringing up syntax errors.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> "Greg Burns" wrote:
>
> > Dim cn As OleDb.OleDbConnection
> >
> > cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="

&
> > Server.MapPath(ConfigurationSettings.AppSettings("path"))) ' -->>>
> > c:\inetpub\wwwroot\global\data\project1.mdb
> >
> > web.config...
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <configuration>
> > <appSettings>
> > <add key="path" value="/global/data/project1.mdb" />
> > </appSettings>
> >
> > <system.web>
> > .... etc
> >
> > HTH,
> > Greg
> >
> > "john smithers" <(E-Mail Removed)> wrote in

message
> > news:8E6CC9A6-1A01-4427-9957-(E-Mail Removed)...
> > > I'm trying to modify the connection string made by the dataadapter

wizard
> > to
> > > a relative path. My current datasource is this:
> > >
> > > ""C:\Inetpub\wwwroot\database\database.mdb""
> > >
> > > How can i change so when its on the server it will look for the

directory
> > > "database" in the root of the virtual directory?
> > >
> > >
> > > cheers

> >
> >
> >



 
Reply With Quote
 
=?Utf-8?B?am9obiBzbWl0aGVycw==?=
Guest
Posts: n/a
 
      6th Sep 2004
I realise playing around in generator code is not the smartest move, thus,
how can I make the dataadapters call a relative path to the database?

"Greg Burns" wrote:

> Changing the desinger generated code is asking for trouble. The designer
> will just overwrite it again when you least expect it.
>
> Greg
>
> 'OleDbConnection1
> '
> Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial
> Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDBatabase L" & _
> "ocking Mode=0;Data
> Source=" & Server.MapPath("/db/database.mdb") & ";Jet OLEDB:Engine " & _
> "Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System
> database=;Jet OLEDB:S" & _
> "FP=False;persist security info=False;Extended
> Properties=;Mode=Share Deny None;J" & _
> "et OLEDB:Encrypt Database=False;Jet OLEDB:Create System
> Database=False;Jet OLEDB" & _
> "on't Copy Locale on Compact=False;Jet OLEDB:Compact Without
> Replica Repair=Fal" & _
> "se;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1"
>
>
> "john smithers" <(E-Mail Removed)> wrote in message
> news:00580164-8444-4EF5-83A2-(E-Mail Removed)...
> > thx for the reply but i'm looking at the "web form designer generated

> code"
> > and have found the oledbdataconnections and just want to modify this. What
> > i'm really having problem with is the syntax.
> >
> > '
> > 'OleDbConnection1
> > '
> > Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial
> > Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDBatabase L" & _
> > "ocking Mode=0;Data
> > Source=""C:\Inetpub\wwwroot\db\database.mdb"";Jet OLEDB:Engine " & _
> > "Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System
> > database=;Jet OLEDB:S" & _
> > "FP=False;persist security info=False;Extended
> > Properties=;Mode=Share Deny None;J" & _
> > "et OLEDB:Encrypt Database=False;Jet OLEDB:Create System
> > Database=False;Jet OLEDB" & _
> > "on't Copy Locale on Compact=False;Jet OLEDB:Compact Without
> > Replica Repair=Fal" & _
> > "se;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1"
> >
> >
> > Data source - i need to change to a relative path like
> > server.mappath(/database/database.mdb) but everything i've tried keeps
> > bringing up syntax errors.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > "Greg Burns" wrote:
> >
> > > Dim cn As OleDb.OleDbConnection
> > >
> > > cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="

> &
> > > Server.MapPath(ConfigurationSettings.AppSettings("path"))) ' -->>>
> > > c:\inetpub\wwwroot\global\data\project1.mdb
> > >
> > > web.config...
> > >
> > > <?xml version="1.0" encoding="utf-8" ?>
> > > <configuration>
> > > <appSettings>
> > > <add key="path" value="/global/data/project1.mdb" />
> > > </appSettings>
> > >
> > > <system.web>
> > > .... etc
> > >
> > > HTH,
> > > Greg
> > >
> > > "john smithers" <(E-Mail Removed)> wrote in

> message
> > > news:8E6CC9A6-1A01-4427-9957-(E-Mail Removed)...
> > > > I'm trying to modify the connection string made by the dataadapter

> wizard
> > > to
> > > > a relative path. My current datasource is this:
> > > >
> > > > ""C:\Inetpub\wwwroot\database\database.mdb""
> > > >
> > > > How can i change so when its on the server it will look for the

> directory
> > > > "database" in the root of the virtual directory?
> > > >
> > > >
> > > > cheers
> > >
> > >
> > >

>
>
>

 
Reply With Quote
 
Greg Burns
Guest
Posts: n/a
 
      6th Sep 2004
John, I never use the wizards so haven't ran into this problem. My gut
response is to say you can't with the wizard (without modify its generated
output, which is BAD), but somebody will just prove me wrong. :^)

I found this article on google:
http://tinyurl.com/4uts9

It shows how to get the wizard generated code to read your web.config for
the datasource value. This avoids "messing" with the designer code
manually, but also doesn't answer your question. (In other words, not sure
how you would get Server.MapPath to act on your web.config value using this
method).

Sorry,
Greg


"john smithers" <(E-Mail Removed)> wrote in message
news:28738814-9E79-4DE9-A20A-(E-Mail Removed)...
>I realise playing around in generator code is not the smartest move, thus,
> how can I make the dataadapters call a relative path to the database?
>
> "Greg Burns" wrote:
>
>> Changing the desinger generated code is asking for trouble. The designer
>> will just overwrite it again when you least expect it.
>>
>> Greg
>>
>> 'OleDbConnection1
>> '
>> Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial
>> Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDBatabase L" & _
>> "ocking Mode=0;Data
>> Source=" & Server.MapPath("/db/database.mdb") & ";Jet OLEDB:Engine " & _
>> "Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System
>> database=;Jet OLEDB:S" & _
>> "FP=False;persist security info=False;Extended
>> Properties=;Mode=Share Deny None;J" & _
>> "et OLEDB:Encrypt Database=False;Jet OLEDB:Create System
>> Database=False;Jet OLEDB" & _
>> "on't Copy Locale on Compact=False;Jet OLEDB:Compact Without
>> Replica Repair=Fal" & _
>> "se;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1"
>>
>>
>> "john smithers" <(E-Mail Removed)> wrote in message
>> news:00580164-8444-4EF5-83A2-(E-Mail Removed)...
>> > thx for the reply but i'm looking at the "web form designer generated

>> code"
>> > and have found the oledbdataconnections and just want to modify this.
>> > What
>> > i'm really having problem with is the syntax.
>> >
>> > '
>> > 'OleDbConnection1
>> > '
>> > Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global
>> > Partial
>> > Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDBatabase L" & _
>> > "ocking Mode=0;Data
>> > Source=""C:\Inetpub\wwwroot\db\database.mdb"";Jet OLEDB:Engine " & _
>> > "Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System
>> > database=;Jet OLEDB:S" & _
>> > "FP=False;persist security info=False;Extended
>> > Properties=;Mode=Share Deny None;J" & _
>> > "et OLEDB:Encrypt Database=False;Jet OLEDB:Create System
>> > Database=False;Jet OLEDB" & _
>> > "on't Copy Locale on Compact=False;Jet OLEDB:Compact Without
>> > Replica Repair=Fal" & _
>> > "se;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1"
>> >
>> >
>> > Data source - i need to change to a relative path like
>> > server.mappath(/database/database.mdb) but everything i've tried keeps
>> > bringing up syntax errors.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > "Greg Burns" wrote:
>> >
>> > > Dim cn As OleDb.OleDbConnection
>> > >
>> > > cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
>> > > Source="

>> &
>> > > Server.MapPath(ConfigurationSettings.AppSettings("path"))) ' -->>>
>> > > c:\inetpub\wwwroot\global\data\project1.mdb
>> > >
>> > > web.config...
>> > >
>> > > <?xml version="1.0" encoding="utf-8" ?>
>> > > <configuration>
>> > > <appSettings>
>> > > <add key="path" value="/global/data/project1.mdb" />
>> > > </appSettings>
>> > >
>> > > <system.web>
>> > > .... etc
>> > >
>> > > HTH,
>> > > Greg
>> > >
>> > > "john smithers" <(E-Mail Removed)> wrote in

>> message
>> > > news:8E6CC9A6-1A01-4427-9957-(E-Mail Removed)...
>> > > > I'm trying to modify the connection string made by the dataadapter

>> wizard
>> > > to
>> > > > a relative path. My current datasource is this:
>> > > >
>> > > > ""C:\Inetpub\wwwroot\database\database.mdb""
>> > > >
>> > > > How can i change so when its on the server it will look for the

>> directory
>> > > > "database" in the root of the virtual directory?
>> > > >
>> > > >
>> > > > cheers
>> > >
>> > >
>> > >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DNS-less Connection String Using VS2K5 Datasource Connection Wizard Ross Culver Microsoft Dot NET Framework Forms 1 19th Feb 2008 01:19 PM
Upsize Wizard ODBC Connection string =?Utf-8?B?Z21lYWQ3?= Microsoft Access 3 13th Oct 2006 03:22 PM
DataAdapter is not using correct connection string Andi Microsoft ADO .NET 3 5th May 2005 05:59 PM
Re: Connection string setting for DataAdapter Carl Prothman [MVP] Microsoft ADO .NET 0 23rd May 2004 06:19 AM
Re: Connection string setting for DataAdapter Pete Wright Microsoft ADO .NET 0 22nd May 2004 08:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:31 AM.