mhsueh001
12-07-2000, 08:26 PM
A few questions.
I'm relatively new to VB (6 months on the job)
I've used SQL for sometime though and I'm working with developing a program for a Client/Server environment.
I'm currently using ADO but have a limited grasp of the differences between a Connection and a Command object when I'm sending SQL statements to the server. Currently I'm using the Connection object in most my routines because I don't have to redeclare a new Command variable.
I've read with the command object I can do some pre-processing to speed some repetitive processes but is this the only advantage?
I'm looking to apply a process that must be
repeated but I'm not looking at a situation where the tables are not the same, nor are the id fields named similar:
ie. Table1: Undergrad Students (Field undid)
Table2: Undergrad Bio Students (Field bioid)
Table3: Business Students (Field busid)
Table4: StudentGrads1987to1990 (Field dateid)
etc.
Some process had to be taken to get these tables, and of course everyone here likes to name their id field differently.
My project is to allow everyone to get the ids for their desired specifications and attach the names of the individuals which is stored in a separate database:
ie Table NAMES with Fields: nameid, firstName, lastName
I want to write a procedure to attach the actual names without having to write multiple SQL statements
ie
SELECT undid, firstName, lastName
INTO sometable
FROM Table1, nameTable
WHERE undid = nameid
Is there a way to set up parameters for different table names with different fields names storing the ids?
Currently I've got a function that accepts a table name and idField name and uses a connection object with a long string to submit the SQL statement. Is there a better way? Is the command object more efficient for submitting a statement above?
I read somewhere, and of course now I can't find the reference, I read to set up a new command object of each SQL statement submitted and not the change the command.commandText for one command object? I don't really understand why. Can an SQL statement like I've got be pre-processed? (My guess is not but not sure why)
Any help would be greatly appreciated.
-- Ming
ming@alumni.ua.edu
I'm relatively new to VB (6 months on the job)
I've used SQL for sometime though and I'm working with developing a program for a Client/Server environment.
I'm currently using ADO but have a limited grasp of the differences between a Connection and a Command object when I'm sending SQL statements to the server. Currently I'm using the Connection object in most my routines because I don't have to redeclare a new Command variable.
I've read with the command object I can do some pre-processing to speed some repetitive processes but is this the only advantage?
I'm looking to apply a process that must be
repeated but I'm not looking at a situation where the tables are not the same, nor are the id fields named similar:
ie. Table1: Undergrad Students (Field undid)
Table2: Undergrad Bio Students (Field bioid)
Table3: Business Students (Field busid)
Table4: StudentGrads1987to1990 (Field dateid)
etc.
Some process had to be taken to get these tables, and of course everyone here likes to name their id field differently.
My project is to allow everyone to get the ids for their desired specifications and attach the names of the individuals which is stored in a separate database:
ie Table NAMES with Fields: nameid, firstName, lastName
I want to write a procedure to attach the actual names without having to write multiple SQL statements
ie
SELECT undid, firstName, lastName
INTO sometable
FROM Table1, nameTable
WHERE undid = nameid
Is there a way to set up parameters for different table names with different fields names storing the ids?
Currently I've got a function that accepts a table name and idField name and uses a connection object with a long string to submit the SQL statement. Is there a better way? Is the command object more efficient for submitting a statement above?
I read somewhere, and of course now I can't find the reference, I read to set up a new command object of each SQL statement submitted and not the change the command.commandText for one command object? I don't really understand why. Can an SQL statement like I've got be pre-processed? (My guess is not but not sure why)
Any help would be greatly appreciated.
-- Ming
ming@alumni.ua.edu