Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics 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 18th, 2008, 06:37 AM
Registered User
 
Join Date: Jan 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access mdb, ASPX and Visual Studio

I need users to access an Access database via a web page. I am building this in Visual Studio which allows you to use VB to a certain extent and produce the web pages to put up on the server. However, trying to find out how to do this, beyond simply putting a data grid on the page, seems to be very difficult.

Minimum functionality is for a user to login, the database holds the user names and passwords. If successful the app would display transactions for that particular user. The user would then be able to post a new transaction which after validating would be added to the database.

So the elements are: Text boxes for username and password (easy so far!) then login button that would look up the user in the db and if valid, return the users full name and location. It would then display a grid of payment transactions so far from the db such as Employee, cash paid, reason, date and balance. Underneath the user could enter a new line and hit a submit button that would validate the data before adding a new line in the db.

I have over 50 sites on the intranet, all linking into this one web page on a Windows 2000 Web server. Creating the page in IIS is straightforward. It is the interaction with the Access database that is the real problem.

I do not have the option of using an SQL server db!

Any help would be greatly appreciated.
 
Old February 19th, 2008, 02:17 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Please be more explicit about the environment you are using. Visual Studio 6? Visual Studio .NET?
 
Old February 21st, 2008, 11:48 AM
Registered User
 
Join Date: Jan 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Didn't expect a response so quick! Right, I am working with Visual Studio 2005 using VB.Net. Web server is 2000 but with latest MDAC so it renders the controls correctly. Access Db is 2003.

Since last post I have figured out how to use the Session variables to pass login details between pages. I have managed to get a data grid on a form. It is populated from a db query specified in the the datasource using the where clauses and text controls supplying the parameters.

All fine but took an disproportionate amount of time to figure out what should be bread and butter stuff! MSN was hardly any help and in fact their solutions either didn't work or actually made life more difficult to say the least.

What I would like now is a simple solution to looking up in a table a login name say and returning the rest of the users details to populate text boxes on the form. An equivalent to using the Access 'seek' command in dao.

Then a simple write back method to that individual record. In this case it maybe changing the users password.

Thanks for responding






 
Old February 21st, 2008, 12:31 PM
Registered User
 
Join Date: Jan 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To clarify, what I am trying to achieve is something like this, as written in Access VBA

dim dbsSomeDb as dao.database
dim rstUsers as dao.recordset
set dbsSomeDb = CurrentDB
set rstUsers = DbsSomeDb.OpenRecordset("tblUsers")

rstUsers.index="LoginNamePassWord"

rstUsers.seek "=", Me.txtLoginName,txtPassword 'On screen Text boxes

If not rstUsers.nomatch then
   msgbox("Invalid Login")
   'Deny access to the rest of the App
Else
   msgbox("Welcome " & rstUsers!FirstName & " " & rstUsers!LastName)
   'ie use the information in the record
End if

Write back would be like:

rstUsers.edit
rstUsers!Password = me.txtPassword
rstUsers.update

All the above in program without anything displayed apart from the text boxes the user enters stuff in. No Grids etc. I do not want to allow users to write directly to the tables. I want them to hit a submit button then extract the data out of text boxes, validate it then and only then write it back to the databse.



 
Old February 21st, 2008, 12:33 PM
Registered User
 
Join Date: Jan 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok before you say a word, the if statement is the wrong way round! :)

 
Old February 21st, 2008, 12:34 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Visual Studio .NET is phenomenally robust, compared to Visual Studio 6. The learning curve is steep, no doubt about it.

But once you learn how to do things, the environment allows for rapid development of rich applications.

The big problem that confronted me in making the transition was that in VB 6 WebClass apps it was very easy to insert or modify the HTML on a web page. That was no longer the case with .NET.

I must tell you that your statement, “Visual Studio ... allows you to use VB to a certain extent” is way off the mark. Visual Studio 6 and Visual Studio .NET both allow you to use Visual Basic robustly in creating and handling web pages, though the ways of doing this are profoundly different.

Unfortunately, after working just a little with VB.NET, I have been re-immersed in VB 6, and won't be much help. But I wanted to encourage you, that after you become familiar with VB.NET, you are going to be astonished at the variety of things you can do.





Similar Threads
Thread Thread Starter Forum Replies Last Post
MS ACCESS + Microsoft Visual Studio neha2007 Visual Studio 2005 0 June 15th, 2007 09:55 AM
FTP in Visual Studio 2005 Pro (Visual Basic) shoopes VB How-To 1 June 29th, 2006 02:08 PM
Visual Studio 2003 vs. Visual Studio 2005 eitanbarazani C# 2005 4 May 9th, 2006 01:34 AM
Visual Studio .net2003 and Visual Studio 2005 Gert Visual C++ 1 January 24th, 2006 05:10 AM
Visual studio 6 or visual studio .NET chaitannyam Visual C++ 1 November 13th, 2005 09:26 AM





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