Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Visual Studio - Calling data from an mdb and placing it in a string


  • Please log in to reply
3 replies to this topic

#1 A30N

A30N

  • Members
  • 6 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:03 PM

Posted 30 July 2011 - 08:55 PM

I'm creating a text based RPG game as a school project, and im having difficulties calling data from an mdb file.
I've set it all up as a data connection, and what I need to do is be able to do is retrieve a certain entity from the database according to a predefined variable. I can't find any tutorials that will let me retrieve a single field, only whole rows, or whole databases into data grids.
There'd be no writing to the database, only extraction of data. I'd assume it could be done using SQL in vb, but im not sure.

So theoretically, what i'd like to be able to do is:
-i set an id number as a variable, say 17 for example.
-the routine then searches down the "id" field till it finds "17"
-The routine goes across the record to the "script" field, withdraws that data and puts it into a string, and does so for a few other fields also.

Any advice as to how i'd go abouts doing this?

Cheers, a30n
KIRBY <3's YOU :D

(>*.*)> <(*.*<)

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:04:03 AM

Posted 31 July 2011 - 09:14 AM

SELECT script FROM myTable WHERE id=17;

#3 A30N

A30N
  • Topic Starter

  • Members
  • 6 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:03 PM

Posted 01 August 2011 - 12:44 AM

SELECT script FROM myTable WHERE id=17;

So would i just make my string equal to that script?
KIRBY <3's YOU :D

(>*.*)> <(*.*<)

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:04:03 AM

Posted 01 August 2011 - 08:01 PM

You said that there was a script field. I assumed that each id correlated to a particular script. So if you had an id equal to 17, you would then have the correlating script. All you need to do is provide the database with the id and the proper query, and it will find the data that you want. Do you have any experience with databases at all? If not you might want to spend some time learning how to insert and retrieve data. There are tons of places online that can show you how to use them. Just do a search for mysql tutorials.

My suggestion would be to follow through some exercises and get some hands on experience (not just reading the examples).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users