Go Back   CodingForums.com > :: Server side development > MySQL > Other Databases

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-09-2012, 03:58 AM   PM User | #1
mwx6205
New Coder

 
Join Date: Jun 2012
Posts: 44
Thanks: 17
Thanked 0 Times in 0 Posts
mwx6205 is an unknown quantity at this point
Question How to prevent hard code?

Hi guys,

I am using Microsoft Access as my database and currently I am facing a problem, how can I prevent from hard code?

Such as
Code:
WHERE ID = 1
. Can I use something to replace 1 to make it more dynamic? Which mean once I update from my database table, then the data will automatic up to date for me without opening up my code to change
Code:
WHERE ID = 1
to
Code:
WHERE ID = 2
maybe?

Thanks in advance.
mwx6205 is offline   Reply With Quote
Old 07-09-2012, 02:14 PM   PM User | #2
guelphdad
Super Moderator


 
guelphdad's Avatar
 
Join Date: Mar 2006
Location: St. Catharines, Ontario Canada
Posts: 2,629
Thanks: 4
Thanked 147 Times in 138 Posts
guelphdad will become famous soon enoughguelphdad will become famous soon enough
Quote:
Originally Posted by mwx6205 View Post
Hi guys,

I am using Microsoft Access as my database
Please ensure then that you post in the general database forum, this particular forum is for mysql questions only.

Thread moved.
guelphdad is offline   Reply With Quote
Old 07-10-2012, 03:11 AM   PM User | #3
mwx6205
New Coder

 
Join Date: Jun 2012
Posts: 44
Thanks: 17
Thanked 0 Times in 0 Posts
mwx6205 is an unknown quantity at this point
Smile

Quote:
Originally Posted by guelphdad View Post
Please ensure then that you post in the general database forum, this particular forum is for mysql questions only.

Thread moved.
Okay. Sorry.
mwx6205 is offline   Reply With Quote
Old 07-10-2012, 06:41 AM   PM User | #4
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 950
Thanks: 7
Thanked 98 Times in 98 Posts
WolfShade is an unknown quantity at this point
I'm not sure I understand your question. Do you want to code something that will replace an automatic increment in the database? Or are you asking about a dynamic server-side language like ASP, PHP, ColdFusion, etc?
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is offline   Reply With Quote
Old 07-10-2012, 09:24 PM   PM User | #5
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
are you using VB macros or a windows form or a webform or ? what is calling the access
this link is on straight up macros for access DB's- if you are hitting it from a form or web page you will need to hit it with an OLE connection- you can reference it here
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE
alykins is offline   Reply With Quote
Old 07-12-2012, 03:27 AM   PM User | #6
mwx6205
New Coder

 
Join Date: Jun 2012
Posts: 44
Thanks: 17
Thanked 0 Times in 0 Posts
mwx6205 is an unknown quantity at this point
Quote:
Originally Posted by WolfShade View Post
I'm not sure I understand your question. Do you want to code something that will replace an automatic increment in the database? Or are you asking about a dynamic server-side language like ASP, PHP, ColdFusion, etc?
Hi WolfShade,

I am asking about a dynamic server-side language and I am using PHP + microsoft access as my database.
mwx6205 is offline   Reply With Quote
Old 07-12-2012, 03:28 AM   PM User | #7
mwx6205
New Coder

 
Join Date: Jun 2012
Posts: 44
Thanks: 17
Thanked 0 Times in 0 Posts
mwx6205 is an unknown quantity at this point
Quote:
Originally Posted by alykins View Post
are you using VB macros or a windows form or a webform or ? what is calling the access
this link is on straight up macros for access DB's- if you are hitting it from a form or web page you will need to hit it with an OLE connection- you can reference it here
Hi alykins,

So sorry that I can't understand what you mean as I am just a very new incomer.
mwx6205 is offline   Reply With Quote
Old 07-12-2012, 08:12 PM   PM User | #8
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
You answered my Q in your reply to WolfShade- you are using a php web page to access the database. I don't know php; sry

The first link I provided though tells you how to make a "stored procedure" in access DB- all you need to do then is call it. Your "hard coded values" would be parameters. So according to their reply you could make something like
Code:
CREATE PROCEDURE usp_GetName
(param1 INT) AS
SELECT [fName]
FROM tbl_People
WHERE id = param1
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE
alykins is offline   Reply With Quote
Users who have thanked alykins for this post:
mwx6205 (07-13-2012)
Old 07-13-2012, 02:54 AM   PM User | #9
mwx6205
New Coder

 
Join Date: Jun 2012
Posts: 44
Thanks: 17
Thanked 0 Times in 0 Posts
mwx6205 is an unknown quantity at this point
Quote:
Originally Posted by alykins View Post
You answered my Q in your reply to WolfShade- you are using a php web page to access the database. I don't know php; sry

The first link I provided though tells you how to make a "stored procedure" in access DB- all you need to do then is call it. Your "hard coded values" would be parameters. So according to their reply you could make something like
Code:
CREATE PROCEDURE usp_GetName
(param1 INT) AS
SELECT [fName]
FROM tbl_People
WHERE id = param1
Hi alykins,

Oh I see, okay :P

Anyway, I need to spend some time to look in deep & thank you so much.

Cheers,
mwx6205.
mwx6205 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


Advertisement
Log in to turn off these ads.