User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 391,739 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,233 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting

Simple ASP.Net Login Page (Using VB.Net)

Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 26
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Simple ASP.Net Login Page (Using VB.Net)

  #42  
Mar 5th, 2005
Hi there Kendel,

You are correct about the import, and if you recall on the Tutorial in the comments I state that very thing:
"Ok remember that you require the creation of a connection object inorder to access the SQL Database. The basics for the connection string (the means of creating this connection object) is;


Imports System.Data.SqlClient
...
Dim oSQLConn As SqlConnection = New SqlConnection()
....


"
and here futher down in the same post

The updated heading to all ASP.Net Page Code Behinds (still using VB.Net):

  '   |||||   This is the Connections Object for an SQL DB
  Dim MyConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("strConn"))
  
And further down in the post I state the following as well :

The updated heading to all ASP.Net Page Code Behinds (still using VB.Net):
  Imports System.Web.Security '   |||||   Required Class for Authentication
  Imports System.Data '   |||||   DB Accessing Import
  Imports System.Data.SqlClient
  Imports System.Configuration	'   ||||||  Required for Web.Config appSettings |||||
  

New Web.Config (partial code only, not the whole file)
  <?xml version="1.0" encoding="utf-8"?> <configuration>  <!-- ||||| Application Settings ||||| -->  
   <appSettings> 
   <add key="strConn" value="Provider=SQLOLEDB;Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI;"/>  
  </appSettings> 
  <system.web>
  ...
  

And I just stated a notable change to the strConn in the web.config for SQL 7.0 or greater today.

The SQL Server .NET Data Provider allows you to connect to a Microsoft SQL Server 7.0 or 2000 database. For Microsoft SQL Server 6.5 or earlier, use the OLE DB .NET Data Provider with the "SQL Server OLE DB Provider" (SQLOLEDB).

Note:
The SQL Server .NET Data Provider knows which data provider it is. Hence the "provider=" part of the connection string is not needed
.
Hope this helps.

With a regards to basic errors like "something xyz is not declared", and as a means for the me better help everyone better, I would appreciate it if you try to investigate the errors you are getting a little better before posting them here. These are generally just a copy and pastee, coding or syntax error, and a fairly easy to fix once you review your code. Hard and fast rules of .Net Framework requires you to DECLARE all variables!

The SQL version of this is still being worked on, and I will have a step by step guide completed before long, just extremely busy at the moments building an Oracle based system and it is very time consuming.

But I will try to answer any questions you have on this thread or the new thread whenever I can. So keep the questions coming!

Happy coding


Originally Posted by Kendel
I'm using SQLServer 7.0

My strConnection in web.config
<appSettings>
<add key="connString" value="server=myDBServer;uid=myid;pwd=myPass;database=myDB" />
</appSettings>

For SQL, I common out the Access thing, and use the syntax for SQL as you suggested:

' First is the Connection Object for an Access DB
' Dim MyConn As OleDbConnection = New OleDbConnection(ConfigurationSettings.AppSettings("connString"))

' This is the Connections Object for an SQL DB
SqlConnection(ConfigurationSettings.AppSettings("connString"))

and I got the error here saying that SqlConnection was not declared.
I thought the import we need for SQLServer is Imports System.Data.SqlClient
not Imports System.Data.OleDb
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
 
All times are GMT -4. The time now is 4:00 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC