BetaONE will rise again!

BetaONE will rise again! (http:\\b1.hcanet.com\forum/index.php)
-   Web Development (http:\\b1.hcanet.com\forum/forumdisplay.php?f=50)
-   -   Databases With Frontpage (http:\\b1.hcanet.com\forum/showthread.php?t=8774)

PCTech 8th Jul 03 09:31 PM

I have an access database of computer information, ranging from computer names to real IP address. even have the whois information logged. I have all the necessary information to log and report a laptop of one of my clients stolen, and able to be identified. How can I access my access database through a webpage? is there a php script that would be best used? should I try to make it on my own? I am also using a server that I programmed in visual basic .net, should I re-make some of the code to work with asp.net? I'm confused as to the aproach I should (or should've) used. Can someone clarify? I know lots of questions in one post.

Thanks,
Humbly confused :angry: ~~PCTech

Sephiroth 9th Jul 03 07:33 PM

1 Attachment(s)
doh, i'm an idiot, had repiled once already but didn't notice you said it was an access database.... :rolleyes:

ok, there's two different ways you can do this. one is to use ASP and/or vbscript, which I have no clue how you would program... but if it's any help, here is code I used for something similar to this through a VB6 app

after you include the DAO Object Library in your project through the references window, you bind your controls to fields in the database, then I used this code:

Code:


'Dim variables to hold the db and recordset.
Dim mdbCurrent As Database
Dim mrstCurrent As Recordset

Private Sub Form_Load()
* 'Set variables, load the current record, and we're not in edit mode.
* Set mdbCurrent = OpenDatabase(App.Path & "\Paymast.mdb")
* Set mrstCurrent = mdbCurrent.OpenRecordset("tblEmployees")
* Call LoadCurrentRecord
* Call SetEditState(False)
End Sub

Private Sub LoadCurrentRecord()
* 'Clear text boxes.
* txtEmployeeID.Text = mrstCurrent![fldEmployeeID]
* txtLastName.Text = mrstCurrent![fldLastName]
* txtFirstName.Text = mrstCurrent![fldFirstName]
* txtStreet.Text = mrstCurrent![fldStreet]
* txtCity.Text = mrstCurrent![fldCity]
* txtState.Text = mrstCurrent![fldState]
* txtZipCode.Text = mrstCurrent![fldZipCode]
* txtHourlyWage.Text = mrstCurrent![fldHourlyWage]
* txtTaxRate.Text = mrstCurrent![fldTaxRate]
End Sub

Private Sub SaveCurrentRecord()
* 'Write the text boxes back to the db.
* mrstCurrent![fldEmployeeID] = txtEmployeeID.Text
* mrstCurrent![fldLastName] = txtLastName.Text
* mrstCurrent![fldFirstName] = txtFirstName.Text
* mrstCurrent![fldStreet] = txtStreet.Text
* mrstCurrent![fldCity] = txtCity.Text
* mrstCurrent![fldState] = txtState.Text
* mrstCurrent![fldZipCode] = txtZipCode.Text
* mrstCurrent![fldHourlyWage] = txtHourlyWage.Text
* mrstCurrent![fldTaxRate] = txtTaxRate.Text
* mrstCurrent.Update
End Sub

Private Sub mnuEditAdd_Click()
* 'Move to the last record, add a new one, clear the boxes, and yes, we are editing.
* mrstCurrent.MoveLast
* mrstCurrent.AddNew
* Call ClearCurrentRecord
* Call SetEditState(True)
End Sub

Private Sub mnuEditCancel_Click()
* 'Ok, I changed my mind, now I don't want to update a record. *Load the current
* 'record and set the edit state to false.
* mrstCurrent.CancelUpdate
* Call LoadCurrentRecord
* Call SetEditState(False)
End Sub

Private Sub mnuEditDelete_Click()
* 'Delete the current record, go to the last one, load it, and set the edit state to false.
* mrstCurrent.Delete
* mrstCurrent.MoveLast
* Call LoadCurrentRecord
* Call SetEditState(False)
End Sub

Private Sub mnuEditEdit_Click()
* 'Now we want to edit a record, set the state to true, and edit away.
* Call SetEditState(True)
* mrstCurrent.Edit
End Sub

Private Sub mnuEditUpdate_Click()
* 'If none of the text boxes are blank, save the record and set the state to false,
* 'else cancel the update, load the current record, set the state to false,
* 'and tell the user to fill everything in.
* If txtEmployeeID.Text = "" Or txtLastName.Text = "" Or txtFirstName.Text = "" _
* Or txtStreet.Text = "" Or txtCity.Text = "" Or txtState.Text = "" _
* Or txtZipCode.Text = "" Or txtHourlyWage.Text = "" Or txtTaxRate.Text = "" Then
* * * MsgBox "Please fill out all of the fields."
* * * mrstCurrent.CancelUpdate
* * * Call LoadCurrentRecord
* * * Call SetEditState(False)
* * * Exit Sub
* End If
* Call SaveCurrentRecord
* Call SetEditState(False)
End Sub

Private Sub mnuFileExit_Click()
* 'I don't want to run anymore.
* Unload Me
End Sub

Private Sub mnuViewFirst_Click()
* 'Move to and load the first record.
* mrstCurrent.MoveFirst
* Call LoadCurrentRecord
End Sub

Private Sub mnuViewLast_Click()
* 'Move to and load the last record.
* mrstCurrent.MoveLast
* Call LoadCurrentRecord
End Sub

Private Sub mnuViewNext_Click()
* 'Move to and load the next record, unless we're at the end already.
* mrstCurrent.MoveNext
* If mrstCurrent.EOF Then
* * * mrstCurrent.MoveLast
* End If
* Call LoadCurrentRecord
End Sub

Private Sub mnuViewPrevious_Click()
* 'Move to and load the previous record, unless we're at the beginning.
* mrstCurrent.MovePrevious
* If mrstCurrent.BOF Then
* * * mrstCurrent.MoveFirst
* End If
* Call LoadCurrentRecord
End Sub

Private Sub SetEditState(pblnEditing As Boolean)
* If pblnEditing Then
* * * 'Unlock all the text boxes, and enable / disable menu items.
* * * txtEmployeeID.Locked = False
* * * txtLastName.Locked = False
* * * txtFirstName.Locked = False
* * * txtHourlyWage.Locked = False
* * * txtStreet.Locked = False
* * * txtCity.Locked = False
* * * txtState.Locked = False
* * * txtZipCode.Locked = False
* * * txtTaxRate.Locked = False
* * * mnuEditEdit.Enabled = False
* * * mnuEditUpdate.Enabled = True
* * * mnuEditCancel.Enabled = True
* * * mnuEditDelete.Enabled = False
* * * mnuEditAdd.Enabled = False
* * * mnuView.Enabled = False
* Else
* * * 'Lock all the text boxes, and enable / disable menu items.
* * * txtEmployeeID.Locked = True
* * * txtLastName.Locked = True
* * * txtFirstName.Locked = True
* * * txtHourlyWage.Locked = True
* * * txtStreet.Locked = True
* * * txtCity.Locked = True
* * * txtState.Locked = True
* * * txtZipCode.Locked = True
* * * txtTaxRate.Locked = True
* * * mnuEditEdit.Enabled = True
* * * mnuEditUpdate.Enabled = False
* * * mnuEditCancel.Enabled = False
* * * mnuEditDelete.Enabled = True
* * * mnuEditAdd.Enabled = True
* * * mnuView.Enabled = True
* End If
End Sub

Private Sub ClearCurrentRecord()
* 'Get rid of the text in the text boxes.
* txtEmployeeID.Text = ""
* txtLastName.Text = ""
* txtFirstName.Text = ""
* txtStreet.Text = ""
* txtCity.Text = ""
* txtState.Text = ""
* txtZipCode.Text = ""
* txtHourlyWage.Text = ""
* txtTaxRate.Text = ""
End Sub


The second way, and probably the easier way, is to use Access's built in data access pages. From what I can remember from my class, here is what you need to do.

1. Open your database up in Access.
2. Click pages on the objects window.
3. Choose either create data access page in design view, or create data access page using wizard.
4. Design your page similar to how you would design a form or switchboard in Access.

After you're done designing the page and save it, it will save an html file. You can publish this on the web, but, here's where you run into a problem.

You have to specify a connection string to your database, which if you're using it on a network, the easiest way is to use a UNC path, IE, \\server\share\mydb.mdb

But, if you use an absolute path, IE, c:\databases\mydb.mdb, then the database has to stay in that place, else when you open the data access page, it won't be able to find and connect to your database. You can edit the source of the page to get around that though. If you search for this line in the html source:

Code:

Data Source=D:\Adam\School\CIS 160\Cases 2\Delivery_SAT.mdb
and edit the path there, it will find it again. I think this is only going to be useful though for a local webserver / intranet, unless you can manage to get it to connect to a remote server somehow someway, ftp maybe? I've never tested it that way.

I've attached a pic of what a very basic data access page will look like once you've walked through the wizard... good luck, if you need help with it let me know and I'll look through my textbook if I don't know it off the top of my head, just finished a course last semester over Access :lol:

PCTech 10th Jul 03 12:23 AM

thanks so much, I'm going to use the page thing. It right now is really simple, and I'll incorpurate it into my webpage :) you were alot of help! thanks again

Thanks,
~PCT

Sephiroth 10th Jul 03 12:26 AM

Quote:

Originally posted by PCTech@Jul 9 2003, 06:23 PM
thanks so much, I'm going to use the page thing. It right now is really simple, and I'll incorpurate it into my webpage :) you were alot of help! thanks again

Thanks,
~PCT

no prob :D

just make sure you put that data access page in a password protected directory, you don't want people finding it and erasing your whole db :lol: :D

Vinnie 10th Jul 03 01:37 AM

I might be off the mark here, but I think you can import a access database into Frontpage 2002.

billybob3 13th Jul 03 12:22 AM

Don't use Front Page...it's a nightmare!!!! Use something like Dreamweaver.

PCTech 13th Jul 03 01:49 AM

i will try all suggestions, and when I finally get it done i'll post a link here for everyone too see my finished work! thanks everyone!

Thanks,
~PCT


All times are GMT +1. The time now is 03:03 AM.

Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.