Showing posts with label access. Show all posts
Showing posts with label access. Show all posts

Thursday, March 29, 2012

NEWBIE - Working with Data in ASP.NET 2.0 :: Creating a Data Access Layer (Sample)

Hi all,

I am really new to ASP.net, so thought I would go through one of the samples on here.

I have started the Working with Data in ASP.NET 2.0 :: Creating a Data Access Layer sample, but I get stuck when i add the code to AllProducts.aspx.cs for some reason, I can add the directive 'using NorthwindTableAdapters' when I compile after adding this directive, I get an error ...

Error 143 The type or namespace name 'NorthWindTableAdapters' could not be found (are you missing a using directive or an assembly reference?) C:\data\tutorial\Default.aspx.cs 10 7 C:\data\tutorial\

Any ideas why I am getting this?

Thanks

Pete

Did u added the northwind database to app_data folder?

you need to add that at first.


Hi Crige,

I added the connection to data connections in the Solution explorer, and also added a dataset item to the project as per the tutorial.

How do I add the database to the app_data_folder, when I right click on app_data I get an add new option dialogue, when I look at the database icon in this dialogue, it shows 'empty database' the database I am using is an existing database on the server...

Pete


I am having the same problem. I'm using SQL 2000 instead of the App_Data approach. The document explains how to use this approach but does not explain that the Northwind database is REQUIRED to be in the App_Data folder. Are you sure that this is required? If not, then what else could be the problem?

Thanks,

Larry
You're not going to believe this...

The class name is case-sensitive... NorthwindTableAdapters must be entered as NorthWindTableAdapters (with a capital W). I noticed this by adding an ObjectDataSource to AllProducts.aspx and then selecting a business object in the 'configure data source' screen. The class name is displayed with a capital W.

At least this gets me past this error message... hope it does the same for you.

Thanks,

Larry
Apparently, I named my DataSet NorthWind, with a capital W. My previous post will only resolve the problem if you did the same...

Note that the tutorial did NOT use a capital W, so I introduced this 'bug' myself by naming the xsd file wrong.Embarrassed

At any rate, it's fixed now so it's time to move on.

Monday, March 26, 2012

Newbie Access Database Question

I'm just starting to learn ASP.net, I have a lot of ASP experience, which probably makes ASP.net even more confusing. Basically what I'm trying to do is read data from an access database and then repeat a certain format until the last database entry. I'll give an example

Database has 5 columns: Section, Author, Title, Link, Bibiography

Website:

Section
Author, Title (linked), Bibiography
...
Author...
Section
Author...

Make sense?

This would be very easy in asp, but I haven't quite gotten the grasp of .netSuggestion: Forget ASP. Yeah it stinks to start over, but it's easier that way.

the 'dot net way':

Grab the data into a data set. Check out theTutorials (linked above). There are also a ton of other sites out there for accessing data from a database with .NET. Search for '.NET + Access + DataSet'.

Once you have it in a DataSet object the rest is sooooo easy. Just setup a repeater object on the page. Then an 'item template' and define how you want each item to look like. Lastly add a seperator template if you want something between records. Finally in the code section do MyRepeater.DataSource = MyDataSet.Tables(0) *your data, then MyRepeater.DataBind() and you'll be all set. If you want tabular data without too crazy of formatting, check out the DataGrid. If you just want to list the results in columns you do the DataSource line from above (except you use a DataGrid object) and the DataBind method call. The rest is automagic.

If you need help with the data access, check out the Access forum in the Data Discussions section.

-Ryan
You can use a Repeater, DataList, or DataGrid for this purpose. This tutorial might be helpful:Binding to Data Display Controls. See also the Tutorials section of this site (in particularData Access and Customization). I think a DataList might suit your purposes pretty well, or a Repeater if you need more control (but also requires more coding).

Terri
thanks for the quick responces...

I looked up how to use the repeater control and it seems like this is what I'm looking for. Is the best way to group all of the same sections together to make an if statment? Is that legal within a repeater? Here's what a sample database looks like

General, Blah, Blah
General, Blah2...
Science, Blah3...
Science, Blah4...

I'd like it to:

General
blah
blah2
Science
blah3
blah4

Thanks for all your help
I think you want to put a Order By clause in your SQL Query.


Select Section, Author, Title, Link, Bibiography from MyDB
Order By Section, Author DESC

This will return
General, bob, bobs book, xxx, xxxx
General, sarah, sarahs book, xxx, xxxx
General, tim, tims book, xxx, xxxx
Science, joe, joes book, xxx, xxx

It first sorts Section alphabetically and then within all matching sections it then sorts on the author.

Friday, March 16, 2012

Newbie needs code pages for SQL Server 2000 access from asp.net page using vb.net


I am only trying to connect to a local host .
I am on Windows 2000 Server with sql 2000 server.

My error is the classic "SQL server does not exist or access denied"
I went to the MS site & they tell me what I know....."some" permissioning
issue.

I had this code working 2 months ago on a different server but now I cannot
get it going now on a different
machine

I can setup ODBC connections every which way to this local server using
Integrated mode access
using different connectivity methods such as by using "local" or
<machinename> or 127.0.0.1 or <machine IP address>. I can also connect
using SQL authentication for user sa or some other new user I created.
So I am not sure about this access denied BS.

I need to connect to Northwind & pubs dbs (the sample dbs that come with sql
2000)
Please post the complete page in (without code behind crap for now).

I went to different sites & they have partial code & they cause different
errors ( I am not a Vb.net guru)

The page I used is something similar to below.

I am just trying to connect & print the server name & SQL version etc

'================
Sub Page_Load(Source As Object, E As EventArgs)

Dim strConnection1 As String = "server=localhost; database=Northwind; " & _

"integrated security=true"

Dim objConnection As New SqlConnection(strConnection)

Dim strSQL As String = "SELECT FirstName, LastName, Country " & _

"FROM Employees;"

Dim objCommand As New SqlCommand(strSQL, objConnection)

objConnection.Open()

Response.Write("ServerVersion: " & objConnection.ServerVersion & _

vbCRLF & "Datasource: " & objConnection.DataSource & _

vbCRLF & "Database: " & objConnection.Database)

dgNameList.DataSource = objCommand.ExecuteReader()

dgNameList.DataBind()

objConnection.Close()

End Sub

'==================

Can someone tell me what is wrong & also ALL the authentication settings
step by step I need in Windows 2000 server / SQL 2000 server ?
This is just the freaking local machine & server. I cannot believe this is
so hard.
Last time someone in some newsgroup had me play with registry settings to
make this work
in addition to some other Windows 2000 user changes
(Sorry I did not save it ...did not know this would be so bad)

I would prefer a complete code page that does both Integrated Auth (as
above) and also
SQL auth (using Username / PW).
(I know the actual call is a one or two line code but the exact format
without syntax or other errors is the key)

I don't have VS-7 so I cannot drag & drop the SQL connector control as
someone suggested.Lori,

When you are connecting to SQL server in integrated security mode IIS is
passing SQL server the account used to run the website. If you haven't
changed the web site to use impersonation (you would do that in the
web.config file) then the site is passing SQL server the anonymous login
account which the website would normally run under. Depending on your needs
their are multiple ways to configure this.

Here's a good article to get you started:

http://support.microsoft.com/defaul...B;EN-US;q176378

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche

"Lori" <__--LoriG--_@.yahoo.com> wrote in message
news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
>
> I am only trying to connect to a local host .
> I am on Windows 2000 Server with sql 2000 server.
>
> My error is the classic "SQL server does not exist or access denied"
> I went to the MS site & they tell me what I know....."some" permissioning
> issue.
> I had this code working 2 months ago on a different server but now I
cannot
> get it going now on a different
> machine
> I can setup ODBC connections every which way to this local server using
> Integrated mode access
> using different connectivity methods such as by using "local" or
> <machinename> or 127.0.0.1 or <machine IP address>. I can also connect
> using SQL authentication for user sa or some other new user I created.
> So I am not sure about this access denied BS.
> I need to connect to Northwind & pubs dbs (the sample dbs that come with
sql
> 2000)
> Please post the complete page in (without code behind crap for now).
> I went to different sites & they have partial code & they cause different
> errors ( I am not a Vb.net guru)
> The page I used is something similar to below.
> I am just trying to connect & print the server name & SQL version etc
> '================
> Sub Page_Load(Source As Object, E As EventArgs)
> Dim strConnection1 As String = "server=localhost; database=Northwind; " &
_
> "integrated security=true"
> Dim objConnection As New SqlConnection(strConnection)
> Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
> "FROM Employees;"
> Dim objCommand As New SqlCommand(strSQL, objConnection)
> objConnection.Open()
> Response.Write("ServerVersion: " & objConnection.ServerVersion & _
> vbCRLF & "Datasource: " & objConnection.DataSource & _
> vbCRLF & "Database: " & objConnection.Database)
> dgNameList.DataSource = objCommand.ExecuteReader()
> dgNameList.DataBind()
> objConnection.Close()
> End Sub
> '==================
> Can someone tell me what is wrong & also ALL the authentication settings
> step by step I need in Windows 2000 server / SQL 2000 server ?
> This is just the freaking local machine & server. I cannot believe this is
> so hard.
> Last time someone in some newsgroup had me play with registry settings to
> make this work
> in addition to some other Windows 2000 user changes
> (Sorry I did not save it ...did not know this would be so bad)
> I would prefer a complete code page that does both Integrated Auth (as
> above) and also
> SQL auth (using Username / PW).
> (I know the actual call is a one or two line code but the exact format
> without syntax or other errors is the key)
>
> I don't have VS-7 so I cannot drag & drop the SQL connector control as
> someone suggested.
>
>
"S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...

> If you haven't
> changed the web site to use impersonation (you would do that in the
> web.config file) then the site is passing SQL server the anonymous login
> account which the website would normally run under.

I have no idea what you mean. Is there an error in logic such as your
sttement should read

======================
> If you haven't
> changed the web site to use impersonation (you would do that in the
> web.config file) then the site is NOT passing SQL server the anonymous
login
> account which the website would normally run under
=============================

> Depending on your needs
> their are multiple ways to configure this.
> Here's a good article to get you started:
> http://support.microsoft.com/defaul...B;EN-US;q176378

The above site shows how to do a DSN connection.
I already said I am able to do a DSN conncection (but am not using it)

If you look at my sample code, it is a DSNless conncection, is it not ?
And another thing.
The Microsoft error message is so misleading.
If there is a problem with IIS permissions why the hell does it say
"SQL server does not exist ?" Very helpful if troubleshooting is it not , by
misleading you ?
Also "access denied" by whom by SQL server ? By 2000 Server ? By IIS ?
Can they be anymore vague ?

"S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> Lori,
> When you are connecting to SQL server in integrated security mode IIS is
> passing SQL server the account used to run the website. If you haven't
> changed the web site to use impersonation (you would do that in the
> web.config file) then the site is passing SQL server the anonymous login
> account which the website would normally run under. Depending on your
needs
> their are multiple ways to configure this.
> Here's a good article to get you started:
> http://support.microsoft.com/defaul...B;EN-US;q176378
> Sincerely,
> --
> S. Justin Gengo, MCP
> Web Developer
> Free code library at:
> www.aboutfortunate.com
> "Out of chaos comes order."
> Nietzche
>
> "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
> > I am only trying to connect to a local host .
> > I am on Windows 2000 Server with sql 2000 server.
> > My error is the classic "SQL server does not exist or access denied"
> > I went to the MS site & they tell me what I know....."some"
permissioning
> > issue.
> > I had this code working 2 months ago on a different server but now I
> cannot
> > get it going now on a different
> > machine
> > I can setup ODBC connections every which way to this local server using
> > Integrated mode access
> > using different connectivity methods such as by using "local" or
> > <machinename> or 127.0.0.1 or <machine IP address>. I can also connect
> > using SQL authentication for user sa or some other new user I created.
> > So I am not sure about this access denied BS.
> > I need to connect to Northwind & pubs dbs (the sample dbs that come with
> sql
> > 2000)
> > Please post the complete page in (without code behind crap for now).
> > I went to different sites & they have partial code & they cause
different
> > errors ( I am not a Vb.net guru)
> > The page I used is something similar to below.
> > I am just trying to connect & print the server name & SQL version etc
> > '================
> > Sub Page_Load(Source As Object, E As EventArgs)
> > Dim strConnection1 As String = "server=localhost; database=Northwind; "
&
> _
> > "integrated security=true"
> > Dim objConnection As New SqlConnection(strConnection)
> > Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
> > "FROM Employees;"
> > Dim objCommand As New SqlCommand(strSQL, objConnection)
> > objConnection.Open()
> > Response.Write("ServerVersion: " & objConnection.ServerVersion & _
> > vbCRLF & "Datasource: " & objConnection.DataSource & _
> > vbCRLF & "Database: " & objConnection.Database)
> > dgNameList.DataSource = objCommand.ExecuteReader()
> > dgNameList.DataBind()
> > objConnection.Close()
> > End Sub
> > '==================
> > Can someone tell me what is wrong & also ALL the authentication settings
> > step by step I need in Windows 2000 server / SQL 2000 server ?
> > This is just the freaking local machine & server. I cannot believe this
is
> > so hard.
> > Last time someone in some newsgroup had me play with registry settings
to
> > make this work
> > in addition to some other Windows 2000 user changes
> > (Sorry I did not save it ...did not know this would be so bad)
> > I would prefer a complete code page that does both Integrated Auth (as
> > above) and also
> > SQL auth (using Username / PW).
> > (I know the actual call is a one or two line code but the exact format
> > without syntax or other errors is the key)
> > I don't have VS-7 so I cannot drag & drop the SQL connector control as
> > someone suggested.
What I am trying say is this
It would make more sense if the error message described that permission was
denied at one of the
possible 3 layers . Even the KB article does not make any references to the
IIS layer.

That said, I am not sure what user to add where in IIS

And another thing.
How would the SQL Auth. work ? Does it not go thru IIS also anyway,
regardless ?

"Lori" <__--LoriG--_@.yahoo.com> wrote in message
news:bjq07b$ljgdk$1@.ID-158805.news.uni-berlin.de...
> And another thing.
> The Microsoft error message is so misleading.
> If there is a problem with IIS permissions why the hell does it say
> "SQL server does not exist ?" Very helpful if troubleshooting is it not ,
by
> misleading you ?
> Also "access denied" by whom by SQL server ? By 2000 Server ? By IIS ?
> Can they be anymore vague ?
> "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> > Lori,
> > When you are connecting to SQL server in integrated security mode IIS is
> > passing SQL server the account used to run the website. If you haven't
> > changed the web site to use impersonation (you would do that in the
> > web.config file) then the site is passing SQL server the anonymous login
> > account which the website would normally run under. Depending on your
> needs
> > their are multiple ways to configure this.
> > Here's a good article to get you started:
> > http://support.microsoft.com/defaul...B;EN-US;q176378
> > Sincerely,
> > --
> > S. Justin Gengo, MCP
> > Web Developer
> > Free code library at:
> > www.aboutfortunate.com
> > "Out of chaos comes order."
> > Nietzche
> > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
> > > > > I am only trying to connect to a local host .
> > > I am on Windows 2000 Server with sql 2000 server.
> > > > > My error is the classic "SQL server does not exist or access denied"
> > > I went to the MS site & they tell me what I know....."some"
> permissioning
> > > issue.
> > > > I had this code working 2 months ago on a different server but now I
> > cannot
> > > get it going now on a different
> > > machine
> > > > I can setup ODBC connections every which way to this local server
using
> > > Integrated mode access
> > > using different connectivity methods such as by using "local" or
> > > <machinename> or 127.0.0.1 or <machine IP address>. I can also
connect
> > > using SQL authentication for user sa or some other new user I created.
> > > So I am not sure about this access denied BS.
> > > > I need to connect to Northwind & pubs dbs (the sample dbs that come
with
> > sql
> > > 2000)
> > > Please post the complete page in (without code behind crap for now).
> > > > I went to different sites & they have partial code & they cause
> different
> > > errors ( I am not a Vb.net guru)
> > > > The page I used is something similar to below.
> > > > I am just trying to connect & print the server name & SQL version etc
> > > > '================
> > > Sub Page_Load(Source As Object, E As EventArgs)
> > > > Dim strConnection1 As String = "server=localhost; database=Northwind;
"
> &
> > _
> > > > "integrated security=true"
> > > > Dim objConnection As New SqlConnection(strConnection)
> > > > Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
> > > > "FROM Employees;"
> > > > Dim objCommand As New SqlCommand(strSQL, objConnection)
> > > > objConnection.Open()
> > > > Response.Write("ServerVersion: " & objConnection.ServerVersion & _
> > > > vbCRLF & "Datasource: " & objConnection.DataSource & _
> > > > vbCRLF & "Database: " & objConnection.Database)
> > > > dgNameList.DataSource = objCommand.ExecuteReader()
> > > > dgNameList.DataBind()
> > > > objConnection.Close()
> > > > End Sub
> > > > '==================
> > > > Can someone tell me what is wrong & also ALL the authentication
settings
> > > step by step I need in Windows 2000 server / SQL 2000 server ?
> > > This is just the freaking local machine & server. I cannot believe
this
> is
> > > so hard.
> > > Last time someone in some newsgroup had me play with registry
settings
> to
> > > make this work
> > > in addition to some other Windows 2000 user changes
> > > (Sorry I did not save it ...did not know this would be so bad)
> > > > I would prefer a complete code page that does both Integrated Auth (as
> > > above) and also
> > > SQL auth (using Username / PW).
> > > (I know the actual call is a one or two line code but the exact format
> > > without syntax or other errors is the key)
> > > > > I don't have VS-7 so I cannot drag & drop the SQL connector control as
> > > someone suggested.
> > > > > > >
Lori,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche

"Lori" <__--LoriG--_@.yahoo.com> wrote in message
news:bjq07b$ljgdk$1@.ID-158805.news.uni-berlin.de...
> And another thing.
> The Microsoft error message is so misleading.
> If there is a problem with IIS permissions why the hell does it say
> "SQL server does not exist ?" Very helpful if troubleshooting is it not ,
by
> misleading you ?
> Also "access denied" by whom by SQL server ? By 2000 Server ? By IIS ?
> Can they be anymore vague ?
> "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> > Lori,
> > When you are connecting to SQL server in integrated security mode IIS is
> > passing SQL server the account used to run the website. If you haven't
> > changed the web site to use impersonation (you would do that in the
> > web.config file) then the site is passing SQL server the anonymous login
> > account which the website would normally run under. Depending on your
> needs
> > their are multiple ways to configure this.
> > Here's a good article to get you started:
> > http://support.microsoft.com/defaul...B;EN-US;q176378
> > Sincerely,
> > --
> > S. Justin Gengo, MCP
> > Web Developer
> > Free code library at:
> > www.aboutfortunate.com
> > "Out of chaos comes order."
> > Nietzche
> > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
> > > > > I am only trying to connect to a local host .
> > > I am on Windows 2000 Server with sql 2000 server.
> > > > > My error is the classic "SQL server does not exist or access denied"
> > > I went to the MS site & they tell me what I know....."some"
> permissioning
> > > issue.
> > > > I had this code working 2 months ago on a different server but now I
> > cannot
> > > get it going now on a different
> > > machine
> > > > I can setup ODBC connections every which way to this local server
using
> > > Integrated mode access
> > > using different connectivity methods such as by using "local" or
> > > <machinename> or 127.0.0.1 or <machine IP address>. I can also
connect
> > > using SQL authentication for user sa or some other new user I created.
> > > So I am not sure about this access denied BS.
> > > > I need to connect to Northwind & pubs dbs (the sample dbs that come
with
> > sql
> > > 2000)
> > > Please post the complete page in (without code behind crap for now).
> > > > I went to different sites & they have partial code & they cause
> different
> > > errors ( I am not a Vb.net guru)
> > > > The page I used is something similar to below.
> > > > I am just trying to connect & print the server name & SQL version etc
> > > > '================
> > > Sub Page_Load(Source As Object, E As EventArgs)
> > > > Dim strConnection1 As String = "server=localhost; database=Northwind;
"
> &
> > _
> > > > "integrated security=true"
> > > > Dim objConnection As New SqlConnection(strConnection)
> > > > Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
> > > > "FROM Employees;"
> > > > Dim objCommand As New SqlCommand(strSQL, objConnection)
> > > > objConnection.Open()
> > > > Response.Write("ServerVersion: " & objConnection.ServerVersion & _
> > > > vbCRLF & "Datasource: " & objConnection.DataSource & _
> > > > vbCRLF & "Database: " & objConnection.Database)
> > > > dgNameList.DataSource = objCommand.ExecuteReader()
> > > > dgNameList.DataBind()
> > > > objConnection.Close()
> > > > End Sub
> > > > '==================
> > > > Can someone tell me what is wrong & also ALL the authentication
settings
> > > step by step I need in Windows 2000 server / SQL 2000 server ?
> > > This is just the freaking local machine & server. I cannot believe
this
> is
> > > so hard.
> > > Last time someone in some newsgroup had me play with registry
settings
> to
> > > make this work
> > > in addition to some other Windows 2000 user changes
> > > (Sorry I did not save it ...did not know this would be so bad)
> > > > I would prefer a complete code page that does both Integrated Auth (as
> > > above) and also
> > > SQL auth (using Username / PW).
> > > (I know the actual call is a one or two line code but the exact format
> > > without syntax or other errors is the key)
> > > > > I don't have VS-7 so I cannot drag & drop the SQL connector control as
> > > someone suggested.
> > > > > > >
Lori,

Sorry about that link. I copied and pasted the wrong one from my list.

Here's the right one:

http://msdn.microsoft.com/library/d.../secnetch12.asp

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche

"Lori" <__--LoriG--_@.yahoo.com> wrote in message
news:bjq0u6$kldqf$1@.ID-158805.news.uni-berlin.de...
> What I am trying say is this
> It would make more sense if the error message described that permission
was
> denied at one of the
> possible 3 layers . Even the KB article does not make any references to
the
> IIS layer.
> That said, I am not sure what user to add where in IIS
> And another thing.
> How would the SQL Auth. work ? Does it not go thru IIS also anyway,
> regardless ?
>
> "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> news:bjq07b$ljgdk$1@.ID-158805.news.uni-berlin.de...
> > And another thing.
> > The Microsoft error message is so misleading.
> > If there is a problem with IIS permissions why the hell does it say
> > "SQL server does not exist ?" Very helpful if troubleshooting is it not
,
> by
> > misleading you ?
> > Also "access denied" by whom by SQL server ? By 2000 Server ? By IIS ?
> > Can they be anymore vague ?
> > "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> > news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> > > Lori,
> > > > When you are connecting to SQL server in integrated security mode IIS
is
> > > passing SQL server the account used to run the website. If you haven't
> > > changed the web site to use impersonation (you would do that in the
> > > web.config file) then the site is passing SQL server the anonymous
login
> > > account which the website would normally run under. Depending on your
> > needs
> > > their are multiple ways to configure this.
> > > > Here's a good article to get you started:
> > > > http://support.microsoft.com/defaul...B;EN-US;q176378
> > > > Sincerely,
> > > > --
> > > S. Justin Gengo, MCP
> > > Web Developer
> > > > Free code library at:
> > > www.aboutfortunate.com
> > > > "Out of chaos comes order."
> > > Nietzche
> > > > > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > > news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
> > > > > > > > I am only trying to connect to a local host .
> > > > I am on Windows 2000 Server with sql 2000 server.
> > > > > > > > My error is the classic "SQL server does not exist or access denied"
> > > > I went to the MS site & they tell me what I know....."some"
> > permissioning
> > > > issue.
> > > > > > I had this code working 2 months ago on a different server but now I
> > > cannot
> > > > get it going now on a different
> > > > machine
> > > > > > I can setup ODBC connections every which way to this local server
> using
> > > > Integrated mode access
> > > > using different connectivity methods such as by using "local" or
> > > > <machinename> or 127.0.0.1 or <machine IP address>. I can also
> connect
> > > > using SQL authentication for user sa or some other new user I
created.
> > > > So I am not sure about this access denied BS.
> > > > > > I need to connect to Northwind & pubs dbs (the sample dbs that come
> with
> > > sql
> > > > 2000)
> > > > Please post the complete page in (without code behind crap for now).
> > > > > > I went to different sites & they have partial code & they cause
> > different
> > > > errors ( I am not a Vb.net guru)
> > > > > > The page I used is something similar to below.
> > > > > > I am just trying to connect & print the server name & SQL version
etc
> > > > > > '================
> > > > Sub Page_Load(Source As Object, E As EventArgs)
> > > > > > Dim strConnection1 As String = "server=localhost;
database=Northwind;
> "
> > &
> > > _
> > > > > > "integrated security=true"
> > > > > > Dim objConnection As New SqlConnection(strConnection)
> > > > > > Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
> > > > > > "FROM Employees;"
> > > > > > Dim objCommand As New SqlCommand(strSQL, objConnection)
> > > > > > objConnection.Open()
> > > > > > Response.Write("ServerVersion: " & objConnection.ServerVersion & _
> > > > > > vbCRLF & "Datasource: " & objConnection.DataSource & _
> > > > > > vbCRLF & "Database: " & objConnection.Database)
> > > > > > dgNameList.DataSource = objCommand.ExecuteReader()
> > > > > > dgNameList.DataBind()
> > > > > > objConnection.Close()
> > > > > > End Sub
> > > > > > '==================
> > > > > > Can someone tell me what is wrong & also ALL the authentication
> settings
> > > > step by step I need in Windows 2000 server / SQL 2000 server ?
> > > > This is just the freaking local machine & server. I cannot believe
> this
> > is
> > > > so hard.
> > > > Last time someone in some newsgroup had me play with registry
> settings
> > to
> > > > make this work
> > > > in addition to some other Windows 2000 user changes
> > > > (Sorry I did not save it ...did not know this would be so bad)
> > > > > > I would prefer a complete code page that does both Integrated Auth
(as
> > > > above) and also
> > > > SQL auth (using Username / PW).
> > > > (I know the actual call is a one or two line code but the exact
format
> > > > without syntax or other errors is the key)
> > > > > > > > I don't have VS-7 so I cannot drag & drop the SQL connector control
as
> > > > someone suggested.
> > > > > > > > > > > > > > > >
"S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
news:O6EeMLHeDHA.3224@.tk2msftngp13.phx.gbl...
> Lori,

?

Yes ?
I appreciate the link but honestly, it is a typical Microsoft link.
They just thorough bits & pieces here & there.

What I need is this (to achieve the simple goal)

1. What I need to do at the Windows 2000 Server level ( User security
settings, Registry or whatever)
2. What I need to do at the IIS-5 level
3. The asp.net code page using vb.net (or even c# is fine).

I was hoping someone would already have the code page & tell me the
corresponding settings
for items 2 & 3 above on their machine to use the code.

I have done enough "fishing" on this & getting tired of it.

"S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
news:eCg4FNHeDHA.2320@.TK2MSFTNGP12.phx.gbl...
> Lori,
> Sorry about that link. I copied and pasted the wrong one from my list.
> Here's the right one:
>
http://msdn.microsoft.com/library/d.../secnetch12.asp
>
> Sincerely,
> --
> S. Justin Gengo, MCP
> Web Developer
> Free code library at:
> www.aboutfortunate.com
> "Out of chaos comes order."
> Nietzche
>
> "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> news:bjq0u6$kldqf$1@.ID-158805.news.uni-berlin.de...
> > What I am trying say is this
> > It would make more sense if the error message described that permission
> was
> > denied at one of the
> > possible 3 layers . Even the KB article does not make any references to
> the
> > IIS layer.
> > That said, I am not sure what user to add where in IIS
> > And another thing.
> > How would the SQL Auth. work ? Does it not go thru IIS also anyway,
> > regardless ?
> > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > news:bjq07b$ljgdk$1@.ID-158805.news.uni-berlin.de...
> > > And another thing.
> > > The Microsoft error message is so misleading.
> > > If there is a problem with IIS permissions why the hell does it say
> > > "SQL server does not exist ?" Very helpful if troubleshooting is it
not
> ,
> > by
> > > misleading you ?
> > > Also "access denied" by whom by SQL server ? By 2000 Server ? By IIS
?
> > > Can they be anymore vague ?
> > > > "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> > > news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> > > > Lori,
> > > > > > When you are connecting to SQL server in integrated security mode
IIS
> is
> > > > passing SQL server the account used to run the website. If you
haven't
> > > > changed the web site to use impersonation (you would do that in the
> > > > web.config file) then the site is passing SQL server the anonymous
> login
> > > > account which the website would normally run under. Depending on
your
> > > needs
> > > > their are multiple ways to configure this.
> > > > > > Here's a good article to get you started:
> > > > > > http://support.microsoft.com/defaul...B;EN-US;q176378
> > > > > > Sincerely,
> > > > > > --
> > > > S. Justin Gengo, MCP
> > > > Web Developer
> > > > > > Free code library at:
> > > > www.aboutfortunate.com
> > > > > > "Out of chaos comes order."
> > > > Nietzche
> > > > > > > > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > > > news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
> > > > > > > > > > > I am only trying to connect to a local host .
> > > > > I am on Windows 2000 Server with sql 2000 server.
> > > > > > > > > > > My error is the classic "SQL server does not exist or access
denied"
> > > > > I went to the MS site & they tell me what I know....."some"
> > > permissioning
> > > > > issue.
> > > > > > > > I had this code working 2 months ago on a different server but now
I
> > > > cannot
> > > > > get it going now on a different
> > > > > machine
> > > > > > > > I can setup ODBC connections every which way to this local server
> > using
> > > > > Integrated mode access
> > > > > using different connectivity methods such as by using "local" or
> > > > > <machinename> or 127.0.0.1 or <machine IP address>. I can also
> > connect
> > > > > using SQL authentication for user sa or some other new user I
> created.
> > > > > So I am not sure about this access denied BS.
> > > > > > > > I need to connect to Northwind & pubs dbs (the sample dbs that
come
> > with
> > > > sql
> > > > > 2000)
> > > > > Please post the complete page in (without code behind crap for
now).
> > > > > > > > I went to different sites & they have partial code & they cause
> > > different
> > > > > errors ( I am not a Vb.net guru)
> > > > > > > > The page I used is something similar to below.
> > > > > > > > I am just trying to connect & print the server name & SQL version
> etc
> > > > > > > > '================
> > > > > Sub Page_Load(Source As Object, E As EventArgs)
> > > > > > > > Dim strConnection1 As String = "server=localhost;
> database=Northwind;
> > "
> > > &
> > > > _
> > > > > > > > "integrated security=true"
> > > > > > > > Dim objConnection As New SqlConnection(strConnection)
> > > > > > > > Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
> > > > > > > > "FROM Employees;"
> > > > > > > > Dim objCommand As New SqlCommand(strSQL, objConnection)
> > > > > > > > objConnection.Open()
> > > > > > > > Response.Write("ServerVersion: " & objConnection.ServerVersion & _
> > > > > > > > vbCRLF & "Datasource: " & objConnection.DataSource & _
> > > > > > > > vbCRLF & "Database: " & objConnection.Database)
> > > > > > > > dgNameList.DataSource = objCommand.ExecuteReader()
> > > > > > > > dgNameList.DataBind()
> > > > > > > > objConnection.Close()
> > > > > > > > End Sub
> > > > > > > > '==================
> > > > > > > > Can someone tell me what is wrong & also ALL the authentication
> > settings
> > > > > step by step I need in Windows 2000 server / SQL 2000 server ?
> > > > > This is just the freaking local machine & server. I cannot believe
> > this
> > > is
> > > > > so hard.
> > > > > Last time someone in some newsgroup had me play with registry
> > settings
> > > to
> > > > > make this work
> > > > > in addition to some other Windows 2000 user changes
> > > > > (Sorry I did not save it ...did not know this would be so bad)
> > > > > > > > I would prefer a complete code page that does both Integrated Auth
> (as
> > > > > above) and also
> > > > > SQL auth (using Username / PW).
> > > > > (I know the actual call is a one or two line code but the exact
> format
> > > > > without syntax or other errors is the key)
> > > > > > > > > > > I don't have VS-7 so I cannot drag & drop the SQL connector
control
> as
> > > > > someone suggested.
> > > > > > > > > > > > > > > > > > > > > > > > > > >
Actually it should read like this

1. What I need to do at the Windows 2000 Server level ( User security
settings, Registry or whatever)
2. What I need to set at the SQL server 2000 level
3. What I need to do at the IIS-5 level
4. The asp.net code page using vb.net (or even c# is fine) & the project
file including web.config file if any

I ran into 100's code pages ( Item 4 ) that tells you how to connect but
none of them address other layers
(Items 1 thru 3 above)

I am hoping some of you can tell me your machine configs for items 1 thru 3
above.
I think item 4 is ok with what I have. (And I suspect item 2 is OK 2 for me)
It is the OS level or IIS settings that are always a pain.
It is amazing how painful it is for even everything local to same machine

"Lori" <__--LoriG--_@.yahoo.com> wrote in message
news:bjqbou$ltkeg$1@.ID-158805.news.uni-berlin.de...
> I appreciate the link but honestly, it is a typical Microsoft link.
> They just thorough bits & pieces here & there.
> What I need is this (to achieve the simple goal)
> 1. What I need to do at the Windows 2000 Server level ( User security
> settings, Registry or whatever)
> 2. What I need to do at the IIS-5 level
> 3. The asp.net code page using vb.net (or even c# is fine).
> I was hoping someone would already have the code page & tell me the
> corresponding settings
> for items 2 & 3 above on their machine to use the code.
> I have done enough "fishing" on this & getting tired of it.
>
>
> "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> news:eCg4FNHeDHA.2320@.TK2MSFTNGP12.phx.gbl...
> > Lori,
> > Sorry about that link. I copied and pasted the wrong one from my list.
> > Here's the right one:
http://msdn.microsoft.com/library/d.../secnetch12.asp
> > Sincerely,
> > --
> > S. Justin Gengo, MCP
> > Web Developer
> > Free code library at:
> > www.aboutfortunate.com
> > "Out of chaos comes order."
> > Nietzche
> > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > news:bjq0u6$kldqf$1@.ID-158805.news.uni-berlin.de...
> > > What I am trying say is this
> > > It would make more sense if the error message described that
permission
> > was
> > > denied at one of the
> > > possible 3 layers . Even the KB article does not make any references
to
> > the
> > > IIS layer.
> > > > That said, I am not sure what user to add where in IIS
> > > > And another thing.
> > > How would the SQL Auth. work ? Does it not go thru IIS also anyway,
> > > regardless ?
> > > > > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > > news:bjq07b$ljgdk$1@.ID-158805.news.uni-berlin.de...
> > > > And another thing.
> > > > The Microsoft error message is so misleading.
> > > > If there is a problem with IIS permissions why the hell does it say
> > > > "SQL server does not exist ?" Very helpful if troubleshooting is it
> not
> > ,
> > > by
> > > > misleading you ?
> > > > Also "access denied" by whom by SQL server ? By 2000 Server ? By
IIS
> ?
> > > > Can they be anymore vague ?
> > > > > > "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> > > > news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> > > > > Lori,
> > > > > > > > When you are connecting to SQL server in integrated security mode
> IIS
> > is
> > > > > passing SQL server the account used to run the website. If you
> haven't
> > > > > changed the web site to use impersonation (you would do that in
the
> > > > > web.config file) then the site is passing SQL server the anonymous
> > login
> > > > > account which the website would normally run under. Depending on
> your
> > > > needs
> > > > > their are multiple ways to configure this.
> > > > > > > > Here's a good article to get you started:
> > > > > > > > http://support.microsoft.com/defaul...B;EN-US;q176378
> > > > > > > > Sincerely,
> > > > > > > > --
> > > > > S. Justin Gengo, MCP
> > > > > Web Developer
> > > > > > > > Free code library at:
> > > > > www.aboutfortunate.com
> > > > > > > > "Out of chaos comes order."
> > > > > Nietzche
> > > > > > > > > > > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > > > > news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
> > > > > > > > > > > > > > I am only trying to connect to a local host .
> > > > > > I am on Windows 2000 Server with sql 2000 server.
> > > > > > > > > > > > > > My error is the classic "SQL server does not exist or access
> denied"
> > > > > > I went to the MS site & they tell me what I know....."some"
> > > > permissioning
> > > > > > issue.
> > > > > > > > > > I had this code working 2 months ago on a different server but
now
> I
> > > > > cannot
> > > > > > get it going now on a different
> > > > > > machine
> > > > > > > > > > I can setup ODBC connections every which way to this local
server
> > > using
> > > > > > Integrated mode access
> > > > > > using different connectivity methods such as by using "local" or
> > > > > > <machinename> or 127.0.0.1 or <machine IP address>. I can also
> > > connect
> > > > > > using SQL authentication for user sa or some other new user I
> > created.
> > > > > > So I am not sure about this access denied BS.
> > > > > > > > > > I need to connect to Northwind & pubs dbs (the sample dbs that
> come
> > > with
> > > > > sql
> > > > > > 2000)
> > > > > > Please post the complete page in (without code behind crap for
> now).
> > > > > > > > > > I went to different sites & they have partial code & they cause
> > > > different
> > > > > > errors ( I am not a Vb.net guru)
> > > > > > > > > > The page I used is something similar to below.
> > > > > > > > > > I am just trying to connect & print the server name & SQL
version
> > etc
> > > > > > > > > > '================
> > > > > > Sub Page_Load(Source As Object, E As EventArgs)
> > > > > > > > > > Dim strConnection1 As String = "server=localhost;
> > database=Northwind;
> > > "
> > > > &
> > > > > _
> > > > > > > > > > "integrated security=true"
> > > > > > > > > > Dim objConnection As New SqlConnection(strConnection)
> > > > > > > > > > Dim strSQL As String = "SELECT FirstName, LastName, Country " &
_
> > > > > > > > > > "FROM Employees;"
> > > > > > > > > > Dim objCommand As New SqlCommand(strSQL, objConnection)
> > > > > > > > > > objConnection.Open()
> > > > > > > > > > Response.Write("ServerVersion: " & objConnection.ServerVersion &
_
> > > > > > > > > > vbCRLF & "Datasource: " & objConnection.DataSource & _
> > > > > > > > > > vbCRLF & "Database: " & objConnection.Database)
> > > > > > > > > > dgNameList.DataSource = objCommand.ExecuteReader()
> > > > > > > > > > dgNameList.DataBind()
> > > > > > > > > > objConnection.Close()
> > > > > > > > > > End Sub
> > > > > > > > > > '==================
> > > > > > > > > > Can someone tell me what is wrong & also ALL the authentication
> > > settings
> > > > > > step by step I need in Windows 2000 server / SQL 2000 server ?
> > > > > > This is just the freaking local machine & server. I cannot
believe
> > > this
> > > > is
> > > > > > so hard.
> > > > > > Last time someone in some newsgroup had me play with registry
> > > settings
> > > > to
> > > > > > make this work
> > > > > > in addition to some other Windows 2000 user changes
> > > > > > (Sorry I did not save it ...did not know this would be so bad)
> > > > > > > > > > I would prefer a complete code page that does both Integrated
Auth
> > (as
> > > > > > above) and also
> > > > > > SQL auth (using Username / PW).
> > > > > > (I know the actual call is a one or two line code but the exact
> > format
> > > > > > without syntax or other errors is the key)
> > > > > > > > > > > > > > I don't have VS-7 so I cannot drag & drop the SQL connector
> control
> > as
> > > > > > someone suggested.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >

Newbie Needs Help

So I am doing the walkthrough on the dynamic help for Visual Studio .net to create a read only data access in a web forms page.

I am coming up with an error and don't know how to fix it... Please help me!!!!

Server Error in '/ReadOnly' Application.
------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30180: Keyword does not name a type.

Source Error:

Line 31: <System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()> _
Line 32: Public Class Global_asax
Line 33: Inherits ReadOnly.Global
Line 34:
Line 35: Private Shared __initialized As Boolean = false

Source File: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\readonly\cc5ec6d7\7a0c1c27\-u9u0vh1.0.vb Line: 33Please provide code. This will help in determinig the problem...
the code for the page that I have written is

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.OleDbConnection1 = New System.Data.OleDb.OleDbConnection
Me.OleDbCommand1 = New System.Data.OleDb.OleDbCommand
'
'OleDbConnection1
'
Me.OleDbConnection1.ConnectionString = "Integrated Security=SSPI;Packet Size=4096;Data Source=018744S;Tag with column col" & _
"lation when possible=False;Initial Catalog=pubs;Use Procedure for Prepare=1;Auto" & _
" Translate=True;Persist Security Info=False;Provider=""SQLOLEDB.1"";Workstation ID" & _
"=018744S;Use Encryption for Data=False"
'
'OleDbCommand1
'
Me.OleDbCommand1.CommandText = "SELECT au_id, au_fname, au_lname, phone FROM authors"
Me.OleDbCommand1.Connection = Me.OleDbConnection1

End Sub
Protected WithEvents OleDbConnection1 As System.Data.OleDb.OleDbConnection
Protected WithEvents OleDbCommand1 As System.Data.OleDb.OleDbCommand
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
OleDbConnection1.Open()
Dim Reader As System.Data.OleDb.OleDbDataReader
Reader = OleDbCommand1.ExecuteReader()
DataGrid1.DataSource = Reader
DataGrid1.DataBind()
Reader.Close()
OleDbConnection1.Close()
End If
End Sub

Private Sub OleDbConnection1_InfoMessage(ByVal sender As System.Object, ByVal e As System.Data.OleDb.OleDbInfoMessageEventArgs) Handles OleDbConnection1.InfoMessage

End Sub
End Class