Showing posts with label sql. Show all posts
Showing posts with label sql. Show all posts

Thursday, March 29, 2012

NEWBIE - Multicolumn Listbox populated from SQL statement

Greetings,

I am attempting to generate a multicolumn listbox from a SQL statement in
ASP.NET. Below is my SQL Statement:

SELECT [PA01101].[PACONTNUMBER], [PA01101].[PAcontname] FROM [PA01101]

I would like a two column list box with [PACONTNUMBER] on the left and
[PAcontname] on the right. I can do this in MS Access with no problem, but
I do not know to get my datareader info into a multicolumn listbox. I can
do one column of data just fine, but cannot add the second column.

Thank you for your help,

-DaveDeclare the listbox on the .aspx page:
<asp:ListBox runat="server" id="LB" /
Then in code-behind, add the items as you iterate through the repeater:
'Get Repeater 'Data'...
While ( Data.Read() )
LB.Items.Add(New ListItem(Data.Item("Field1") + "-" + Data.Item("Field2"), Data.Item("Field1")))
End While

Note: The above code will have [Field1-Field2] as the text field and [Field1] as the value field for each item in the SqlDataReader

"RockNRoll" wrote:

> Greetings,
> I am attempting to generate a multicolumn listbox from a SQL statement in
> ASP.NET. Below is my SQL Statement:
> SELECT [PA01101].[PACONTNUMBER], [PA01101].[PAcontname] FROM [PA01101]
> I would like a two column list box with [PACONTNUMBER] on the left and
> [PAcontname] on the right. I can do this in MS Access with no problem, but
> I do not know to get my datareader info into a multicolumn listbox. I can
> do one column of data just fine, but cannot add the second column.
> Thank you for your help,
> -Dave
>
concatenate two columns into one in your sql query

select column1 + column2 as multicolumn
from mytable

then have your datareader use "multicolumn" as your textfield. You'll probably have to do some spacing on top of this if you want the results in actual columns, but that should be easy enough.

Also there is a third party control that does multi-column listbox and some more stuff
http://easylistbox.com/demoQuickStart.aspx#easy

--Michael

"RockNRoll" <daveweber@.yahoo.com> wrote in message news:eJAoYOkeEHA.3916@.TK2MSFTNGP11.phx.gbl...
> Greetings,
>
> I am attempting to generate a multicolumn listbox from a SQL statement in
> ASP.NET. Below is my SQL Statement:
>
> SELECT [PA01101].[PACONTNUMBER], [PA01101].[PAcontname] FROM [PA01101]
>
> I would like a two column list box with [PACONTNUMBER] on the left and
> [PAcontname] on the right. I can do this in MS Access with no problem, but
> I do not know to get my datareader info into a multicolumn listbox. I can
> do one column of data just fine, but cannot add the second column.
>
> Thank you for your help,
>
> -Dave
>

NEWBIE - Multicolumn Listbox populated from SQL statement

Greetings,
I am attempting to generate a multicolumn listbox from a SQL statement in
ASP.NET. Below is my SQL Statement:
SELECT [PA01101].[PACONTNUMBER], [PA01101].[PAcontname] FROM [PA01101]
I would like a two column list box with [PACONTNUMBER] on the left and
[PAcontname] on the right. I can do this in MS Access with no problem, but
I do not know to get my datareader info into a multicolumn listbox. I can
do one column of data just fine, but cannot add the second column.
Thank you for your help,
-DaveDeclare the listbox on the .aspx page:
<asp:ListBox runat="server" id="LB" />
Then in code-behind, add the items as you iterate through the repeater:
'Get Repeater 'Data'...
While ( Data.Read() )
LB.Items.Add(New ListItem(Data.Item("Field1") + "-" + Data.Item("Field2"), D
ata.Item("Field1")))
End While
Note: The above code will have [Field1-Field2] as the text field and [Field1
] as the value field for each item in the SqlDataReader
"RockNRoll" wrote:

> Greetings,
> I am attempting to generate a multicolumn listbox from a SQL statement in
> ASP.NET. Below is my SQL Statement:
> SELECT [PA01101].[PACONTNUMBER], [PA01101].[PAcontname] FROM [PA01101]
> I would like a two column list box with [PACONTNUMBER] on the left and
> [PAcontname] on the right. I can do this in MS Access with no problem, but
> I do not know to get my datareader info into a multicolumn listbox. I can
> do one column of data just fine, but cannot add the second column.
> Thank you for your help,
> -Dave
>
>
concatenate two columns into one in your sql query
select column1 + column2 as multicolumn
from mytable
then have your datareader use "multicolumn" as your textfield. You'll =
probably have to do some spacing on top of this if you want the results =
in actual columns, but that should be easy enough.
Also there is a third party control that does multi-column listbox and =
some more stuff
http://easylistbox.com/demoQuickStart.aspx#easy
--Michael
"RockNRoll" <daveweber@.yahoo.com> wrote in message =
news:eJAoYOkeEHA.3916@.TK2MSFTNGP11.phx.gbl...
> Greetings,
>=20
> I am attempting to generate a multicolumn listbox from a SQL statement =
in
> ASP.NET. Below is my SQL Statement:
>=20
> SELECT [PA01101].[PACONTNUMBER], [PA01101].[PAcontname] FROM [PA01101]
>=20
> I would like a two column list box with [PACONTNUMBER] on the left and
> [PAcontname] on the right. I can do this in MS Access with no =
problem, but
> I do not know to get my datareader info into a multicolumn listbox. I =
can
> do one column of data just fine, but cannot add the second column.
>=20
> Thank you for your help,
>=20
> -Dave
>=20
>

Monday, March 26, 2012

Newbie ASP project

Guys,

I have just developed a quite large app in VB.NET that integrates with a SQL dbase. I have now been asked to develop a very simple app in ASP, this would take me a day or so in VB.NET, but I'm gonna struggle in ASP.NET.

This project is a questionnaire that will be completed by users, via a webpage, this will then write back to a SQL database. There are 50 questions, these are always the same, the answers are multi-choice.

I'm thinking this is an easy task, but time is against me ! Has anybody got any code examples, or is there a better way to do this ! If anybody could point out the key differences between coding in ASP.NET and VB.NET it would be appreciated !

Cheers
BobIf you know VB.NET you shouldn't have too much trouble transfering over to ASP.NET. It's all very similar. The thing that ofter confuses people though is the whole client server relationship. Your ASP code will run on the server ONLY, it compiles to HTLM and some Script. So things like mouse over, timers etc don't work. Also your page is reloaded on every postback. Thus global var's don't retain there info, you need to use session var's instead. You also need to reload any buttons etc you've added and addhandler for them again. www.asp.net has a lot of good info.

TPM

Saturday, March 24, 2012

newbie dropdownlist question

I'm sure this is obvious but.

I have an employee details form for an intranet to a sql server database. A number of controls in the form will be dropdown lists used as lookups. ie I have a jobno in the employee
table which would be linked to a jobsid in a jobs table. The only table which would be updated is the employee table.

I am using a separate datasets. I cant set the datatext to jobs.id and the datavalue to employee.jobno

The item shown in the list would be the employees id.

I don't know if the dataset would be the corect method?

Any assistance greatly appreciated.Write a query/view (woteva) using links to retrieve the required data for the dropdownlist and populate it into the same DataSet.

Newbie Forms Question

Hello All -

I have intermediate experience with MS SQL 2000 Server Programming and now getting into .net, ASP.net, VB.net and ADO.net to be more specific.
I was given this simple project to build a data entry form to insert some data in a SQL table. I have the form ready and need some help on how to take the data from my form (text box, drop downs) and send to my sql table, I've read some articles about data adapter but still not sure how to use that.
I'm also consfused between using the code on the web page or the code behind.

Any light you guys can shed will be welcome, thanks in advance.

Depends on what version of ASP.NET you're working with. If using 2.0, then I suggest you read through the following. Lots of info there with examples...

http://www.asp.net/QuickStart/aspnet/Default.aspx

Newbie Help! - Inserting Data into SQL

Hi All,

I need some help with ASP.NET 2.0. I come from a strong classic-ASP / VBScript / SQL development background and I'm now learning .net 2.0 to get back into the swing of things. So far I have hit a few snags, and this is the latest that I have not been able to get around.

What I have is 2 pages:

1. page1.aspx showing a single database record, with one of the rows in the detailsview a HyperLink row. This links to page2.aspx, with a Querystring of "id=", the value being the ID column of the displayed record. The single record that is shown is from a table called "tblBooks"

2. page2.aspx which I want to use to add a new record of data in a linked (but unrelated) table (tblAuthors - there can be any number of authors, hence another related table) to the one shown on page1.aspx.

What I want to do is get the querystring (Page.Request.QueryString("ID").toString) and feed it into the "BookID" field of the insert form on page2.aspx.

Firstly, is there an easier way that I am overlooking? If not, how do I get the BookID to be shown on page2.aspx, with the other 2 fields (Author first and last name) in insert mode?

Thanks in advance!!

Dominik.

Hello Dominik,

My suggestion is to use a business object to store and present your data. See the first 2 introduction tutorials onhttp://asp.net/learn/data-access/

After that you will have the feeling you stepped out of a time-machine and are light-years away from classic-ASP.

Jeroen Molenaar.


jeroenm:

My suggestion is to use a business object to store and present your data. See the first 2 introduction tutorials onhttp://asp.net/learn/data-access/

Wow, I wrote code behind a button, in the same way I would if designing a classic VB6-style application. That was after I created the dataset and associated Update, Insert, etc, functions in the designer. Very nice :-)

Thanks!

Dominik

Thursday, March 22, 2012

newbie in asp.net

can anybody tell me what is wrong here


public void updateMessage ( object src, EventArgs e )
{
string ServerName = "xxx"; // SQL server name
string Database = "xxx"; // SQL Database Name
string user = "xxx"; // SQL User name
string Pass = "xxx"; // SQL Password

SqlConnection myConn = new SqlConnection("server=" + ServerName + ";database=" + Database + ";UID=" + user + ";PWD=" + Pass + ";");
SqlCommand myCmd = new SqlCommand ( );

SqlDataAdapter myAdapter = new SqlDataAdapter ("select * from cars where ID=" + TheID, myConn );
DataTable msgDetails = new DataTable ( );
myAdapter.Fill ( msgDetails );
DataRowView myRow = msgDetails.DefaultView [ 0 ] ;

SqlDataReader rdr;

if ( Page.IsValid )
{
myCmd.CommandText = "UPDATE cars SET Fastnumer=@dotnet.itags.org.Fastnumer, Tegund=@dotnet.itags.org.Tegund where id=" + TheID;

msgFastnumer.Value = myRow [ "Fastnumer" ].ToString ( );
msgTegund.Value = myRow [ "Tegund" ].ToString ( );

myCmd.Parameters.Add ( "@dotnet.itags.org.Fastnumer", SqlDbType.NVarChar ).Value = msgFastnumer.Value;
myCmd.Parameters.Add ( "@dotnet.itags.org.Tegund", SqlDbType.NVarChar ).Value = msgTegund.Value;

myConn.Open ( );
rdr = myCmd.ExecuteReader ( );
myGrid.DataSource = rdr;
myGrid.DataBind ( );
rdr.Close();
myConn.Close ( );

}
bindPostPanel ( TheID );
}

ExecuteReader: Connection property has not been initialized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: ExecuteReader: Connection property has not been initialized.

Source Error:

Line 140:
Line 141: myConn.Open ( );
Line 142: rdr = myCmd.ExecuteReader ( );
Line 143: myGrid.DataSource = rdr;
Line 144: myGrid.DataBind ( );Well, for starters, you need to set the Connection property of your SqlCommand:


myCmd.Connection = myConn;

Newbie master/detail question

I have a form that collects info for a database. I can insert the master record using a dataset but how to I get the sql server generated id back from the db to use in my detail inserts?Readthis discussion

Newbie looking for help... Data driven navigation

Is it possible to generate ASP.net website navigation based entirely on SQL queries?

If so, is it better to generate a static sitemap by running these queries only when a change is made to the database,

or

is it better to allow the queries to run "realtime" on page load and whenever a link is clicked?

Sorry if I'm not too clear, I'm still "extremely" wet behind the ears. ;-)

Thanks in advance,

Jeff

Well not sure if this is the answer you are looking for, but Asp.net 2.0 has a very good new feature Site Map where you can use the Site Map Provider to configure your Navigation of your website.


Hi,

Take a look at these tutorials

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/sitemapdatasource.aspx

http://www.asp.net/learn/data-access/tutorial-62-cs.aspx

One thing you might want to do is cache the SiteMap the first time your page load, that way you will avoid unnecessary db roundtrips.

However if your SiteMap is going to be changing all the time than you can leave the caching out.

Goodluck


The second link is exactly what I was looking for. Thanks.

The link you posted is appending an extra character though, breaking the link, so I reposted it below. (This link points to the VB tutorial)

http://www.asp.net/learn/data-access/tutorial-62-vb.aspx

Jeff

Newbie Membership question

I have a database that I want to basically place on the web. I have user information inside a table within this database. The database is an SQL Server DB. My question is how to use the membership and role features when a db with user info is already created. Are there any good examples of this out there? Thanks.

First off: there is a whole "Security" forum dedicated to membership and role talk

Secondly: what you are going to be after is a "Customer Membership Provider"


I also have a list of good security resources on ASP.NET 2.0 here:http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx

It includes a nice video that walksthrough how to setup a login system.

Hope this helps,

Scott

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 - pull value from sql table

I have searched this forum and can't find the answer to my question. I have a login page that validates username/password. I am validating that the username is in the sql table, but I would also like to return the rest of the information for that user to pass in a querystring. For example, the user ID . I have setup my sql string to select username, password, Name, and email. How do I pull the id from this dataset?


userDataset = myUserVAlidation(enterUsername, enterPassword)
If userDataset.tables(0).rows.count = 1 then
'found record in database table
ENd if

Function myUserValidation(ByVal username as string, byVal password as string)
Dim connectionString as ...
Dim sqlConn as system.data.sqlclient.sqlconnection = new system.data.sqlClient.sqlconnection(connectionSTring)
Dim sqlString as string = "Select [userTable][username], [userTable][password], [userTable][fullName], [userTable][id] where (([userTable].[username] = @dotnet.itags.org.username) and ([userTable].[password] = @dotnet.itags.org.password))"

Dim sqlCommand as system.data.sqlclient.sqlcommand = new system.data.sqlclient.sqlCommand(sqlString, sqlConn)

sqlCommand.parameters.add("@dotnet.itags.org.username", system.data.sqldbtype.varchar).value = username
sqlCommand.parameters.add("@dotnet.itags.org.password", system.data.sqldbtype.varchar).value = password

dim dataAdapter as system.data.sqlclient.sqldataadapter = new system.data.sqlclient.sqldataadapter(sqlCommand)
dim dataset as system.data.dataset = new system.data.dataset
dataadapter.fill(dataset)
return dataset

end function

To get the id you could use the following:
string id = userDataset.Tables[0].Rows[0].ItemArray.GetValue(3)
The index for GetValue = 3 because id is the 4th column returned from your sql statement.

Newbie Needs Help!

Hi,
I'd appreciate some advise... I've been assigned the task of creating form
based authentication via SQL Server for a section of our corporate web site.
I know classic ASP quite well, but the ASP .NET world is very different.
And from what I've read, ASP .NET has some great functionality built into it
for form based authentication. What I'd like to know is how to make this
work.
Currently, our corporate web server is IIS 5.0 on a Win2K Pro Server in our
DMZ. (We are upgrading to IIS 6 / Win2003 Pro Server next month.) I need
to manage access to a handful of subfolders in the website. The subfolders
contain .html, .asp, and .pdf files.
Will IIS 5.0 support ASP .Net's built in methods for the integrated form
based authentication approach? (The .Net Framework, ver 1.1, is installed).
Obviously, I could go the classic ASP approach and place code in the top of
each page to do some kind of check for authentication. If the check
passes, generate the page, else redirect to the login. However, I'd prefer
to not have to modify every page.
Assuming that setup will work, how will an ASP .NET form based
authentication manage access to .pdf files and static .html files?
At this point, please don't send any code. I'd just appreciate a response
as to whether this is possible and it if it is, what's the best approach to
make it happen.
Thanks kindly,
-JoeAFAIK, forms based authentication is used only to control access to pages in
your ASP.NET application. It simply works by testing to see if you have a
valid ticket for the current session (usually set once login is successful)
if there isn't one then the user is redirected to a login page, usually
defined in the Web.Config file.
Access to files via a direct URL will, I think, only be controlled by the
filesystem access allowed to the directory in question, so I there is a
security restrictions in place then the user might be prompted to enter
their credentials into a windows dialog box.
Hope that help a bit.
IIS 5 does indeed support ASP.NET 1.1 and all that goes with it.
MattC
"Joe Rigley" <jcrigley@.spartanmotors.com> wrote in message
news:unlXnGfOFHA.2604@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I'd appreciate some advise... I've been assigned the task of creating
> form based authentication via SQL Server for a section of our corporate
> web site. I know classic ASP quite well, but the ASP .NET world is very
> different. And from what I've read, ASP .NET has some great functionality
> built into it for form based authentication. What I'd like to know is how
> to make this work.
> Currently, our corporate web server is IIS 5.0 on a Win2K Pro Server in
> our DMZ. (We are upgrading to IIS 6 / Win2003 Pro Server next month.) I
> need to manage access to a handful of subfolders in the website. The
> subfolders contain .html, .asp, and .pdf files.
> Will IIS 5.0 support ASP .Net's built in methods for the integrated form
> based authentication approach? (The .Net Framework, ver 1.1, is
> installed). Obviously, I could go the classic ASP approach and place code
> in the top of each page to do some kind of check for authentication. If
> the check passes, generate the page, else redirect to the login. However,
> I'd prefer to not have to modify every page.
> Assuming that setup will work, how will an ASP .NET form based
> authentication manage access to .pdf files and static .html files?
> At this point, please don't send any code. I'd just appreciate a response
> as to whether this is possible and it if it is, what's the best approach
> to make it happen.
> Thanks kindly,
> -Joe
>
On Tue, 05 Apr 2005 10:11:12 -0500, Joe Rigley
<jcrigley@.spartanmotors.com> wrote:

> Hi,
> I'd appreciate some advise... I've been assigned the task of creating
> form
> based authentication via SQL Server for a section of our corporate web
> site.
> I know classic ASP quite well, but the ASP .NET world is very different.
> And from what I've read, ASP .NET has some great functionality built
> into it
> for form based authentication. What I'd like to know is how to make this
> work.
> Currently, our corporate web server is IIS 5.0 on a Win2K Pro Server in
> our
> DMZ. (We are upgrading to IIS 6 / Win2003 Pro Server next month.) I
> need
> to manage access to a handful of subfolders in the website. The
> subfolders
> contain .html, .asp, and .pdf files.
> Will IIS 5.0 support ASP .Net's built in methods for the integrated form
> based authentication approach? (The .Net Framework, ver 1.1, is
> installed).
> Obviously, I could go the classic ASP approach and place code in the top
> of
> each page to do some kind of check for authentication. If the check
> passes, generate the page, else redirect to the login. However, I'd
> prefer
> to not have to modify every page.
> Assuming that setup will work, how will an ASP .NET form based
> authentication manage access to .pdf files and static .html files?
> At this point, please don't send any code. I'd just appreciate a
> response
> as to whether this is possible and it if it is, what's the best approach
> to
> make it happen.
> Thanks kindly,
> -Joe
>
I'd recommend reading up on Forms Authentication; it does exactly what you
would want to do in ASP. It sets a cookie on the user's system to say
whether they are logged in or not; if not they are sent to the login
page. In addition, you may want to check out the concept 'impersonation'
if it's something that may be useful here (intranet application?).
As far as non-aspnet files, as mentioned, IIS by default will be the one
to determine permissions on the folder, files, etc. When a request comes
in for an aspx file, IIS looks up aspx in the ISAPI dll mappings in MMC,
and passes it to the aspnet ISAPI dll (which in essence passes it to the
aspnet worker process). However, if it's not a .NET-type of file such as
html, pdf, etc. IIS will do whatever is setup in the MMC for ISAPI dll
mappings. Which as we know html and pdf are just served up to the user.
You can map the aspnet ISAPI dll to these other file extensions in IIS,
and then Forms Authentication can also protect them. Note there was talk
there may be performance hits and/or maybe corruption problems by doing
this (aspnet handling non-aspnet files), though I've never actually heard
of major problems with it.
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Hi Joe,
Good thinking. I think you will do well with ASP.Net. That said, however, if
you don't have any experience with ASP.Net, you should think about how long
you have to write your app. Just learining ASP.Net could take you several
months, or perhaps longer. It's huge.
If you have plenty of time, by all means, jump in! The water's great!
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
What You S Is What You Get.
"Joe Rigley" <jcrigley@.spartanmotors.com> wrote in message
news:unlXnGfOFHA.2604@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I'd appreciate some advise... I've been assigned the task of creating
> form based authentication via SQL Server for a section of our corporate
> web site. I know classic ASP quite well, but the ASP .NET world is very
> different. And from what I've read, ASP .NET has some great functionality
> built into it for form based authentication. What I'd like to know is how
> to make this work.
> Currently, our corporate web server is IIS 5.0 on a Win2K Pro Server in
> our DMZ. (We are upgrading to IIS 6 / Win2003 Pro Server next month.) I
> need to manage access to a handful of subfolders in the website. The
> subfolders contain .html, .asp, and .pdf files.
> Will IIS 5.0 support ASP .Net's built in methods for the integrated form
> based authentication approach? (The .Net Framework, ver 1.1, is
> installed). Obviously, I could go the classic ASP approach and place code
> in the top of each page to do some kind of check for authentication. If
> the check passes, generate the page, else redirect to the login. However,
> I'd prefer to not have to modify every page.
> Assuming that setup will work, how will an ASP .NET form based
> authentication manage access to .pdf files and static .html files?
> At this point, please don't send any code. I'd just appreciate a response
> as to whether this is possible and it if it is, what's the best approach
> to make it happen.
> Thanks kindly,
> -Joe
>
Craig,
Thanks for the great information. You mentioned Impersonation. How would
that help me?
-Joe
"Craig Deelsnyder" <cdeelsny@.no_spam_4_meyahoo.com> wrote in message
news:op.sorovfme75dg5d@.deelscwxp2.na.corp.born.com...
> On Tue, 05 Apr 2005 10:11:12 -0500, Joe Rigley
> <jcrigley@.spartanmotors.com> wrote:
>
> I'd recommend reading up on Forms Authentication; it does exactly what you
> would want to do in ASP. It sets a cookie on the user's system to say
> whether they are logged in or not; if not they are sent to the login
> page. In addition, you may want to check out the concept 'impersonation'
> if it's something that may be useful here (intranet application?).
> As far as non-aspnet files, as mentioned, IIS by default will be the one
> to determine permissions on the folder, files, etc. When a request comes
> in for an aspx file, IIS looks up aspx in the ISAPI dll mappings in MMC,
> and passes it to the aspnet ISAPI dll (which in essence passes it to the
> aspnet worker process). However, if it's not a .NET-type of file such as
> html, pdf, etc. IIS will do whatever is setup in the MMC for ISAPI dll
> mappings. Which as we know html and pdf are just served up to the user.
> You can map the aspnet ISAPI dll to these other file extensions in IIS,
> and then Forms Authentication can also protect them. Note there was talk
> there may be performance hits and/or maybe corruption problems by doing
> this (aspnet handling non-aspnet files), though I've never actually heard
> of major problems with it.
> --
> Craig Deelsnyder
> Microsoft MVP - ASP/ASP.NET
On Tue, 05 Apr 2005 14:46:35 -0500, Joe Rigley
<jcrigley@.spartanmotors.com> wrote:

> Craig,
> Thanks for the great information. You mentioned Impersonation. How
> would
> that help me?
> -Joe
>
Ah, I got a little carried away, you pry won't need it for what you
described, but it is helpful to know about in case you need some forms of
resource access control:
http://msdn.microsoft.com/library/d...personation.asp
http://msdn.microsoft.com/library/d...personation.asp
basically it's a way to have aspnet use the credentials of the current
user, making it easier to do things such as access files, etc. Don't
think you need it, but useful to know for future reference
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET

Newbie Needs Help!

Hi,

I'd appreciate some advise... I've been assigned the task of creating form
based authentication via SQL Server for a section of our corporate web site.
I know classic ASP quite well, but the ASP .NET world is very different.
And from what I've read, ASP .NET has some great functionality built into it
for form based authentication. What I'd like to know is how to make this
work.

Currently, our corporate web server is IIS 5.0 on a Win2K Pro Server in our
DMZ. (We are upgrading to IIS 6 / Win2003 Pro Server next month.) I need
to manage access to a handful of subfolders in the website. The subfolders
contain .html, .asp, and .pdf files.

Will IIS 5.0 support ASP .Net's built in methods for the integrated form
based authentication approach? (The .Net Framework, ver 1.1, is installed).
Obviously, I could go the classic ASP approach and place code in the top of
each page to do some kind of check for authentication. If the check
passes, generate the page, else redirect to the login. However, I'd prefer
to not have to modify every page.

Assuming that setup will work, how will an ASP .NET form based
authentication manage access to .pdf files and static .html files?

At this point, please don't send any code. I'd just appreciate a response
as to whether this is possible and it if it is, what's the best approach to
make it happen.

Thanks kindly,
-JoeAFAIK, forms based authentication is used only to control access to pages in
your ASP.NET application. It simply works by testing to see if you have a
valid ticket for the current session (usually set once login is successful)
if there isn't one then the user is redirected to a login page, usually
defined in the Web.Config file.

Access to files via a direct URL will, I think, only be controlled by the
filesystem access allowed to the directory in question, so I there is a
security restrictions in place then the user might be prompted to enter
their credentials into a windows dialog box.

Hope that help a bit.

IIS 5 does indeed support ASP.NET 1.1 and all that goes with it.

MattC
"Joe Rigley" <jcrigley@.spartanmotors.com> wrote in message
news:unlXnGfOFHA.2604@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I'd appreciate some advise... I've been assigned the task of creating
> form based authentication via SQL Server for a section of our corporate
> web site. I know classic ASP quite well, but the ASP .NET world is very
> different. And from what I've read, ASP .NET has some great functionality
> built into it for form based authentication. What I'd like to know is how
> to make this work.
> Currently, our corporate web server is IIS 5.0 on a Win2K Pro Server in
> our DMZ. (We are upgrading to IIS 6 / Win2003 Pro Server next month.) I
> need to manage access to a handful of subfolders in the website. The
> subfolders contain .html, .asp, and .pdf files.
> Will IIS 5.0 support ASP .Net's built in methods for the integrated form
> based authentication approach? (The .Net Framework, ver 1.1, is
> installed). Obviously, I could go the classic ASP approach and place code
> in the top of each page to do some kind of check for authentication. If
> the check passes, generate the page, else redirect to the login. However,
> I'd prefer to not have to modify every page.
> Assuming that setup will work, how will an ASP .NET form based
> authentication manage access to .pdf files and static .html files?
> At this point, please don't send any code. I'd just appreciate a response
> as to whether this is possible and it if it is, what's the best approach
> to make it happen.
> Thanks kindly,
> -Joe
On Tue, 05 Apr 2005 10:11:12 -0500, Joe Rigley
<jcrigley@.spartanmotors.com> wrote:

> Hi,
> I'd appreciate some advise... I've been assigned the task of creating
> form
> based authentication via SQL Server for a section of our corporate web
> site.
> I know classic ASP quite well, but the ASP .NET world is very different.
> And from what I've read, ASP .NET has some great functionality built
> into it
> for form based authentication. What I'd like to know is how to make this
> work.
> Currently, our corporate web server is IIS 5.0 on a Win2K Pro Server in
> our
> DMZ. (We are upgrading to IIS 6 / Win2003 Pro Server next month.) I
> need
> to manage access to a handful of subfolders in the website. The
> subfolders
> contain .html, .asp, and .pdf files.
> Will IIS 5.0 support ASP .Net's built in methods for the integrated form
> based authentication approach? (The .Net Framework, ver 1.1, is
> installed).
> Obviously, I could go the classic ASP approach and place code in the top
> of
> each page to do some kind of check for authentication. If the check
> passes, generate the page, else redirect to the login. However, I'd
> prefer
> to not have to modify every page.
> Assuming that setup will work, how will an ASP .NET form based
> authentication manage access to .pdf files and static .html files?
> At this point, please don't send any code. I'd just appreciate a
> response
> as to whether this is possible and it if it is, what's the best approach
> to
> make it happen.
> Thanks kindly,
> -Joe

I'd recommend reading up on Forms Authentication; it does exactly what you
would want to do in ASP. It sets a cookie on the user's system to say
whether they are logged in or not; if not they are sent to the login
page. In addition, you may want to check out the concept 'impersonation'
if it's something that may be useful here (intranet application?).

As far as non-aspnet files, as mentioned, IIS by default will be the one
to determine permissions on the folder, files, etc. When a request comes
in for an aspx file, IIS looks up aspx in the ISAPI dll mappings in MMC,
and passes it to the aspnet ISAPI dll (which in essence passes it to the
aspnet worker process). However, if it's not a .NET-type of file such as
html, pdf, etc. IIS will do whatever is setup in the MMC for ISAPI dll
mappings. Which as we know html and pdf are just served up to the user.

You can map the aspnet ISAPI dll to these other file extensions in IIS,
and then Forms Authentication can also protect them. Note there was talk
there may be performance hits and/or maybe corruption problems by doing
this (aspnet handling non-aspnet files), though I've never actually heard
of major problems with it.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Hi Joe,

Good thinking. I think you will do well with ASP.Net. That said, however, if
you don't have any experience with ASP.Net, you should think about how long
you have to write your app. Just learining ASP.Net could take you several
months, or perhaps longer. It's huge.

If you have plenty of time, by all means, jump in! The water's great!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Joe Rigley" <jcrigley@.spartanmotors.com> wrote in message
news:unlXnGfOFHA.2604@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I'd appreciate some advise... I've been assigned the task of creating
> form based authentication via SQL Server for a section of our corporate
> web site. I know classic ASP quite well, but the ASP .NET world is very
> different. And from what I've read, ASP .NET has some great functionality
> built into it for form based authentication. What I'd like to know is how
> to make this work.
> Currently, our corporate web server is IIS 5.0 on a Win2K Pro Server in
> our DMZ. (We are upgrading to IIS 6 / Win2003 Pro Server next month.) I
> need to manage access to a handful of subfolders in the website. The
> subfolders contain .html, .asp, and .pdf files.
> Will IIS 5.0 support ASP .Net's built in methods for the integrated form
> based authentication approach? (The .Net Framework, ver 1.1, is
> installed). Obviously, I could go the classic ASP approach and place code
> in the top of each page to do some kind of check for authentication. If
> the check passes, generate the page, else redirect to the login. However,
> I'd prefer to not have to modify every page.
> Assuming that setup will work, how will an ASP .NET form based
> authentication manage access to .pdf files and static .html files?
> At this point, please don't send any code. I'd just appreciate a response
> as to whether this is possible and it if it is, what's the best approach
> to make it happen.
> Thanks kindly,
> -Joe
Craig,

Thanks for the great information. You mentioned Impersonation. How would
that help me?

-Joe

"Craig Deelsnyder" <cdeelsny@.no_spam_4_meyahoo.com> wrote in message
news:op.sorovfme75dg5d@.deelscwxp2.na.corp.born.com ...
> On Tue, 05 Apr 2005 10:11:12 -0500, Joe Rigley
> <jcrigley@.spartanmotors.com> wrote:
>> Hi,
>>
>> I'd appreciate some advise... I've been assigned the task of creating
>> form
>> based authentication via SQL Server for a section of our corporate web
>> site.
>> I know classic ASP quite well, but the ASP .NET world is very different.
>> And from what I've read, ASP .NET has some great functionality built
>> into it
>> for form based authentication. What I'd like to know is how to make this
>> work.
>>
>> Currently, our corporate web server is IIS 5.0 on a Win2K Pro Server in
>> our
>> DMZ. (We are upgrading to IIS 6 / Win2003 Pro Server next month.) I
>> need
>> to manage access to a handful of subfolders in the website. The
>> subfolders
>> contain .html, .asp, and .pdf files.
>>
>> Will IIS 5.0 support ASP .Net's built in methods for the integrated form
>> based authentication approach? (The .Net Framework, ver 1.1, is
>> installed).
>> Obviously, I could go the classic ASP approach and place code in the top
>> of
>> each page to do some kind of check for authentication. If the check
>> passes, generate the page, else redirect to the login. However, I'd
>> prefer
>> to not have to modify every page.
>>
>> Assuming that setup will work, how will an ASP .NET form based
>> authentication manage access to .pdf files and static .html files?
>>
>> At this point, please don't send any code. I'd just appreciate a
>> response
>> as to whether this is possible and it if it is, what's the best approach
>> to
>> make it happen.
>>
>> Thanks kindly,
>> -Joe
>>
>>
> I'd recommend reading up on Forms Authentication; it does exactly what you
> would want to do in ASP. It sets a cookie on the user's system to say
> whether they are logged in or not; if not they are sent to the login
> page. In addition, you may want to check out the concept 'impersonation'
> if it's something that may be useful here (intranet application?).
> As far as non-aspnet files, as mentioned, IIS by default will be the one
> to determine permissions on the folder, files, etc. When a request comes
> in for an aspx file, IIS looks up aspx in the ISAPI dll mappings in MMC,
> and passes it to the aspnet ISAPI dll (which in essence passes it to the
> aspnet worker process). However, if it's not a .NET-type of file such as
> html, pdf, etc. IIS will do whatever is setup in the MMC for ISAPI dll
> mappings. Which as we know html and pdf are just served up to the user.
> You can map the aspnet ISAPI dll to these other file extensions in IIS,
> and then Forms Authentication can also protect them. Note there was talk
> there may be performance hits and/or maybe corruption problems by doing
> this (aspnet handling non-aspnet files), though I've never actually heard
> of major problems with it.
> --
> Craig Deelsnyder
> Microsoft MVP - ASP/ASP.NET
On Tue, 05 Apr 2005 14:46:35 -0500, Joe Rigley
<jcrigley@.spartanmotors.com> wrote:

> Craig,
> Thanks for the great information. You mentioned Impersonation. How
> would
> that help me?
> -Joe

Ah, I got a little carried away, you pry won't need it for what you
described, but it is helpful to know about in case you need some forms of
resource access control:

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

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

basically it's a way to have aspnet use the credentials of the current
user, making it easier to do things such as access files, etc. Don't
think you need it, but useful to know for future reference

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET