'null'???? PLEASE HELP!

'null'???? PLEASE HELP!

Post by Blair Lawrenc » Sat, 11 Jan 2003 00:07:26



I'm trying to connect remotley to a database. I go through all these steps
and "TEST Connection" and it works just find.
When I press F5 I get the follow when I click the button in the browser. Am
I missing something here?
----------------------------------------------------
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.

----------------------------------------------------------
These are the steps I followed:

Objective
After completing this practice, you will be able to create a data form by
using the Data Form Wizard.

Scenario
The Data Form Wizard automatically generates Visual Basic forms that contain
individual bound controls and procedures used to manage information from
database tables and queries. The Wizard can create either single query forms
that manage the data from a single table or a simple query, or it can create
Master/Detail forms that manage more complex one-to-many data relationships.
If using a control, you also can create a grid or datasheet form. The Data
Form Wizard is used in conjunction with only the ADO Data control.

Use the Data Form Wizard to rapidly build forms with controls bound to a
data source; to create single record, grid, and Master/Detail forms; or to
rapidly create prototype data-based forms.

To complete this practice, you need to install SQL Server and restore the
NWTradersTravel database. Restore the database backup files from <Drive
Letter>:\SelfStudy\Practice\SQLDatabase.

  a.. NWTRADERSTravel.bak --> NWTradersTravel
Procedure
To restore the NWTradersTravel database

  1.. Click Start. Point to Programs, point to Microsoft SQL Server 2000
Server, and click Enterprise Manager.
  2.. In the left pane, access the Database folder.
  3.. Right-click the Database folder.
  4.. Select New Database.
  5.. Type the name for the database as NWTradersTravel in the Name text box
and click OK. A database called NWTradersTravel is created.
  6.. Right-click NWTradersTravel.
  7.. Select All Tasks.
  8.. Click Restore Database....
  9.. In the General tab, select From Device.
  10.. Click Select Devices....
  11.. Click Add.
  12.. Under the Filename: option button, click the Ellipsis(...) button.
  13.. Select the NWTradersTravel.bak file located at <Drive
Letter>:\Practice\SQLDatabase.
  14.. Click OK.
  15.. Click Options.
  16.. Select the Force restore over existing database check box.
  17.. Click OK.
  18.. Click OK.
  19.. Click OK.
To create a new Web project

  1.. Open Microsoft Visual Studio.NET.
  2.. On the File menu, point to New, and then click Project.
  3.. In the New Project dialog box, do the following:
    1.. In the Project Types pane, select Visual Basic Projects.
    2.. In the Templates pane, select ASP.NET Web Application.
    3.. In the Name box, type WebApplication2 as the name of your project,
accept the default location (http://localhost), and click OK.
To create a data form by using the Data Form Wizard

  1.. On the File menu, click Add New Item.
  The Add New Item dialog box displays.

  2.. Expand the Web Project Items node in the Categories pane.
  3.. Click Data Form Wizard in the Templates pane.
  4.. Notice that the default name of the data form is DataWebForm1.aspx. To
accept the default name, click Open.
  The Data Form Wizard Welcome screen displays.

  5.. Click Next.
  6.. Type NorthWind as name for the DataSet in the Create a new dataset
named box, and then click Next.
  7.. Choose a connection from the list of connections displayed and click
Next, or click New Connection to create a new connection.
    1.. If you click New Connection, the Data Link Properties dialog box
displays.
    2.. Click the Provider tab.
    3.. Click Microsoft OLE DB Provider for SQL Server from the list of
providers displayed and click Next.
    4.. Select your computer name from Select or enter a server name
drop-down list.
    5.. Select Use Windows NT Integrated security.
    6.. Click Select the database on the server option, and select the
NWTradersTravel database from the drop-down list.
    7.. Click Test Connection.
    8.. Click OK to return to the Choose a data connection screen of the
Data Form Wizard. Click Next.
  8.. Choose a single table or view you want to add to your data form by
selecting it from the list of available items and clicking the > button.
  The table or view appears in the Selected items list.

  9.. Click Next.
  10.. Choose the tables and columns you want displayed on the form, and
click Finish.
  You can select a column to appear on the data form by checking the column
in the list of columns displayed.

  11.. Set the data form as the startup page for the project, and run the
project. To do so, follow these steps:
    1.. In the Solution Explorer window, right-click the file
DataWebFrom1.aspx.
    2.. Click Set as Start Page.
    3.. Press F5 to run the project.
    Internet Explorer displays the data form.

 
 
 

'null'???? PLEASE HELP!

Post by Gregory A. Beame » Sat, 11 Jan 2003 00:28:28


By default, the wizards set up a trusted connection. By default, web apps
are set up with anonymous access. This gives you an anonymous (null) user
logging in to a system that expects your logon.

Four choices:
1. Set up anonymous user for access - unwise, but possible
2. Lock down the application to force an NTFS logon. Can be done by turning
off anonymous in IIS or setting NTFS permissions on the directory/page, et
al, in Windows Explorer
3. Use impersonation for the connection - quite a bit of code just for data
access
4. Use SQL Server mixed mode security and alter the connection string to use
a particular user/password combination - this is the easiest, by far. Some
businesses do not allow mixed mode on SQL Server, so it is not always an
option

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

****************************************************************************
****
Think outside the box!
****************************************************************************
****

Quote:> I'm trying to connect remotley to a database. I go through all these steps
> and "TEST Connection" and it works just find.
> When I press F5 I get the follow when I click the button in the browser.
Am
> I missing something here?
> ----------------------------------------------------
> Login failed for user '(null)'. Reason: Not associated with a trusted SQL
> Server connection.

> ----------------------------------------------------------
> These are the steps I followed:

> Objective
> After completing this practice, you will be able to create a data form by
> using the Data Form Wizard.

> Scenario
> The Data Form Wizard automatically generates Visual Basic forms that
contain
> individual bound controls and procedures used to manage information from
> database tables and queries. The Wizard can create either single query
forms
> that manage the data from a single table or a simple query, or it can
create
> Master/Detail forms that manage more complex one-to-many data
relationships.
> If using a control, you also can create a grid or datasheet form. The Data
> Form Wizard is used in conjunction with only the ADO Data control.

> Use the Data Form Wizard to rapidly build forms with controls bound to a
> data source; to create single record, grid, and Master/Detail forms; or to
> rapidly create prototype data-based forms.

> To complete this practice, you need to install SQL Server and restore the
> NWTradersTravel database. Restore the database backup files from <Drive
> Letter>:\SelfStudy\Practice\SQLDatabase.

>   a.. NWTRADERSTravel.bak --> NWTradersTravel
> Procedure
> To restore the NWTradersTravel database

>   1.. Click Start. Point to Programs, point to Microsoft SQL Server 2000
> Server, and click Enterprise Manager.
>   2.. In the left pane, access the Database folder.
>   3.. Right-click the Database folder.
>   4.. Select New Database.
>   5.. Type the name for the database as NWTradersTravel in the Name text
box
> and click OK. A database called NWTradersTravel is created.
>   6.. Right-click NWTradersTravel.
>   7.. Select All Tasks.
>   8.. Click Restore Database....
>   9.. In the General tab, select From Device.
>   10.. Click Select Devices....
>   11.. Click Add.
>   12.. Under the Filename: option button, click the Ellipsis(...) button.
>   13.. Select the NWTradersTravel.bak file located at <Drive
> Letter>:\Practice\SQLDatabase.
>   14.. Click OK.
>   15.. Click Options.
>   16.. Select the Force restore over existing database check box.
>   17.. Click OK.
>   18.. Click OK.
>   19.. Click OK.
> To create a new Web project

>   1.. Open Microsoft Visual Studio.NET.
>   2.. On the File menu, point to New, and then click Project.
>   3.. In the New Project dialog box, do the following:
>     1.. In the Project Types pane, select Visual Basic Projects.
>     2.. In the Templates pane, select ASP.NET Web Application.
>     3.. In the Name box, type WebApplication2 as the name of your project,
> accept the default location (http://localhost), and click OK.
> To create a data form by using the Data Form Wizard

>   1.. On the File menu, click Add New Item.
>   The Add New Item dialog box displays.

>   2.. Expand the Web Project Items node in the Categories pane.
>   3.. Click Data Form Wizard in the Templates pane.
>   4.. Notice that the default name of the data form is DataWebForm1.aspx.
To
> accept the default name, click Open.
>   The Data Form Wizard Welcome screen displays.

>   5.. Click Next.
>   6.. Type NorthWind as name for the DataSet in the Create a new dataset
> named box, and then click Next.
>   7.. Choose a connection from the list of connections displayed and click
> Next, or click New Connection to create a new connection.
>     1.. If you click New Connection, the Data Link Properties dialog box
> displays.
>     2.. Click the Provider tab.
>     3.. Click Microsoft OLE DB Provider for SQL Server from the list of
> providers displayed and click Next.
>     4.. Select your computer name from Select or enter a server name
> drop-down list.
>     5.. Select Use Windows NT Integrated security.
>     6.. Click Select the database on the server option, and select the
> NWTradersTravel database from the drop-down list.
>     7.. Click Test Connection.
>     8.. Click OK to return to the Choose a data connection screen of the
> Data Form Wizard. Click Next.
>   8.. Choose a single table or view you want to add to your data form by
> selecting it from the list of available items and clicking the > button.
>   The table or view appears in the Selected items list.

>   9.. Click Next.
>   10.. Choose the tables and columns you want displayed on the form, and
> click Finish.
>   You can select a column to appear on the data form by checking the
column
> in the list of columns displayed.

>   11.. Set the data form as the startup page for the project, and run the
> project. To do so, follow these steps:
>     1.. In the Solution Explorer window, right-click the file
> DataWebFrom1.aspx.
>     2.. Click Set as Start Page.
>     3.. Press F5 to run the project.
>     Internet Explorer displays the data form.