MySQL and Oracle using SqlDataSource control

M

Mr Seth T

I am creating a web app that needs to distribute to be able to be
distributed to MySQL sites and Oracle sites. So far I have developed
it for MySQL and now I am going back and adding Oracle support. I am
having trouble with my SqlDataSources; the app is full of them. When I
am using my MySQL connection it takes parameters like
UserDepts.user_uid = @user_uid

But, when the connection is an Oracle connection I don't know what
they're supposed to look like. I know the parameter is " :user_uid "
but it's not working with just that change. I thought the framework
was supposed to make it so that all I do is change the connection and
all this would be taken care of, but now it looks like I am going to
have to go to every page and do a ...

if(isOracle())
{
SqlDataSource1.SelectCommand = "SELECT DISTINCT
DEPARTMENTS.DEPT_UID, DEPT_NAME FROM DEPARTMENTS INNER JOIN USERDEPTS
ON USERDEPTS.DEPT_UID = DEPARTMENTS.DEPT_UID WHERE USER_UID = :user_uid
AND DEPARTMENTS.MARK_BYTE <> 1 ORDER BY DEPT_NAME";

}
else
{
SqlDataSource1.SelectCommand = "SELECT DISTINCT
Departments.dept_uid, dept_name FROM Departments INNER JOIN UserDepts
ON UserDepts.dept_uid = Departments.dept_uid WHERE user_uid = @user_uid
AND Departments.mark_byte <> 1 ORDER BY dept_name";
}

for every SQLDataSource plus whatever changes I will still need to make
to make it actually work (like put something inside quotation marks).
That's terrible! There has got to be a better way!
(not to mention the stored procedure nightmare I'm fixing to go
through) So what other changes do I need to make to the SQL statement
and is there a way to avoid this entirely? I sure hope so.

Thanks for any help,
-Seth

(if this needs to be in another group, just let me know)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top