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
Wireless networking problem limited or no connectivity
dissallow / ban decimal (period) character in text field in Livecycle
object library invalid contains references to object definitions that could not be found
How do I fully clear and rebuild a full-text search catalog in SQL 2005 Express
URGENT! Cannot log into SQL Server after password change
Quality banner exchange network
Stop Adsense Security Error: Content at <a rel="nofollow" href="http://googleads.g.doubleclick.net/" target="_blank">http://googleads.g.doublec<wbr />lick.net/</a> may not load data from...
VBA code to determine Bookmark name and copy it.
Trying to edit fRSMemberReferenceBL with ADSI Edit and get error attribute owned by system
cannot do System Restore