Microsoft
Software
Hardware
Network
Question : How to connect to database using Vbscript?
Hello All,
I got a Access Database with Name Zipcodes and i got a html page named Zipcode.html an di got 4 text fields Zip, county, City and State. When the user enter a Zip and tab out of it the remaining fields to be filled by using the database.
Here is my html page:
Zipcode.html
Zip:
County:
City:
State:
Can you tell how to do ? I am new to Vb Script as we can't do in java script.
Thanks in advance
Muddasa
Answer : How to connect to database using Vbscript?
The simplest way i can see to do this is to use ASP.NET VB and set your Zip code field to post back to the server. You'd then create a a dataset upon postback inserting the Zip code the user has submitted into the SQL statement, something along the lines of "SELECT * FROM mydatabasetable WHERE myzipcode = " & TxtZip.text . The other fields are then populated by the results of this query eg within the Sub Page_Load event write the results into the textboxes like 'TxtCity.text = MyDataset.FieldValue("City
", Container)'
If you are unsure of how auto postback works in asp.net, i've included an example below, copy this code below into a page and call it tester.aspx, put in in your wwwroot folder and call it as
http://localhost/tester.as
px
- Make sure you have the .net framework installed on your server though or it wont work!
Zip:
Country:
City:
State:
Random Solutions
Adding todays date to file names
SQL - Copy todays records from one table to another table (Scheduled)
Query Accounts with Automatically update email addresses based on recipient policy Unchecked
Actionscript FLV playlist
Restore an old Dir.edb - Will it backfill from other servers
Update Query to update one record from multiple records
Braviax.exe not removable as SDFix.exe won't open...
Server 2003 small business want to be a domain server
Outlook/Exchange - Very Slow
Remote Ghosting