Wrox Programmer Forums
|
BOOK: Beginning ASP.NET Databases Also see the forum ASP Databases for more general discussions of ASP database issues not directly related to these books.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 4th, 2005, 01:56 AM
Registered User
 
Join Date: Feb 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to dmorganorourke@msn.com
Default Chapter 3 examples

Is there something that you must do to Internet Explorer in order to run these examples.

I'm completely new to asp.net and pretty new to VB but I've written about a thousand connection strings to access and that example won't run either.

I can connect and run other VB code against the NorthwindSQL4 database as well as the Nwind.mdb Access database and can run queries against the NorthwindSQL4 using osql.exe so I think that I have the database set up right.

Any help is appreciated. Thanks in advance.

the code I'm running for the SQLServer_Connection.aspx is as follows:

<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Data.SqlClient" %>

<html>
  <head>
    <title>Beginning ASP.NET Databases Chapter 3</title>
  </head>

  <body>
    <h4>First Example: Listing data from the Employees table</h4>
    <asp:DataGrid id="dgNameList"
                  runat="server"
                  Gridlines="None"
                  BackColor="LightBlue"
                  CellPadding="5"
                  CellSpacing="5"
                  BorderWidth="2"
                  BorderColor="Black"
                  ToolTip="Includes only those employees who are at HQ" />
  <body>
</html>

<script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)
  Dim strConnection As String = "server=(local); database=NorthwindSQL4; " & _
                                "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
</script>

David B. Morgan
 
Old June 4th, 2005, 08:50 PM
Friend of Wrox
 
Join Date: May 2005
Posts: 227
Thanks: 1
Thanked 7 Times in 7 Posts
Default

David,
if this is the actual code u r using, then the </body> is missing in the statement before the </html>. Make this change and u should see results. Hope this helps.
 
Old January 10th, 2006, 02:42 PM
Registered User
 
Join Date: Feb 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to dmorganorourke@msn.com
Default

also try:
As it turned out the problem that I was having was that I had not set up (registered ASP with the IIS). The following advice from another thread allowed me to create AND VIEW all the samples through chapter 4 at least as they appeared in the book. Hope this helps those who had similar problems.

1) Open a command window. (Click Start, click Run, type cmd, and then click OK.)
2) Navigate to the directory of the Aspnet_regiis.exe version you want to use. Remember that each version of the .NET Framework comes with its own version.

The file is usually located in the following directory:
for XP c:\windows\Microsoft.NET\Framework\<versionNumber>
for 2000 c:\winnt\microsoft.net\framework\<versionNumber>

Then type aspnet_regiis.exe -i

As a result of viewing a lot of similar postings for help I also saw that a lot of people had problems with page 66 describing setting up the virtual directory in XP. In xp just set up the BegASPNETdb folder and webroot subfolder normally as you would any folder using my computer and then rightclick on the webroot folder (from within the BegASPNETdb folder) and select properties. Then click on the websharing tab and select the 'Share this Folder' button and click add. The dialog shown on page 66 will appear and you can follow the directions shown there.

David B. Morgan
 
Old January 18th, 2006, 04:03 PM
Registered User
 
Join Date: Feb 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to dmorganorourke@msn.com
Default

With everyone's help I got the connection working the way I had hoped and thought it might be useful to wrap this up with some points that I learned. (I am working with xp pro)


- The path to the file must be shared with network users. If simple file sharing is not disabled, this includes all of the parent folders.
- If the access file has permissions enabled, you must include in the connection a [user id = MyUser;] and a [Password = myPassword;] including the semicolons but eliminating the brackets inside the quotes for the connection string. The order does not appear to be significant.
- Also if the access file has permissions enabled, you must change the systemdb value key in the windows registry to the full path and filename of the .mdw (Workgroup Information) file that is active when the access file permissions are set so the user and password information is accessable. The default is blank. This key is found at [HKEY_Local_Machine]\Software\Microsoft\Jet\4.0\Engines
-The errors (paraphrased) below occurred when each of the following conditions were the case.

   File is already open for exclusive use or you do not have the required permissions - This occurred when the folder sharing was not set up properly.
   Missing or corrupt system information file - Occurred when the key was not set up properly.
   Not a valid account name or password - occurred when the user name or password were misspelled.

Thanks to Nalla and Peace95 and the folks over at experts-exchange for all your help.



David B. Morgan





Similar Threads
Thread Thread Starter Forum Replies Last Post
examples raheleh BOOK: Beginning JavaServer Pages 0 October 2nd, 2007 12:17 AM
Chapter 11 Code Examples ablinco BOOK: Professional VB 2005 ISBN: 0-7645-7536-8 0 October 9th, 2006 03:56 AM
examples in Chapter 3 rna5132 JSP Basics 8 October 7th, 2003 11:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.