VS2005 - random SQL

  • Thread starter Thread starter William Buchanan
  • Start date Start date
W

William Buchanan

Hi folks

I want to make an app which will run any SQL entered by a user on any db.
How can I do this using the new data features?

In VS 2003 I could have dragged an SQL connection etc onto my form, but this
doesn't exist any more (ok... they are there but not on the toolbar). So, do
I still need to use the old method or is there a new way of doing this?

Thanks in advance.

Will
 
Jesús, I'm with William. I added the components to the tool box and they
work. But I used to be able to drag a stored proc from the server explorer to
the visual design and it would create a sqlConnection (if needed) and a
sqlCommand. I'm sure there is some way to turn this functionality back on.

Thanks in advance for the help...Chuck
 
Chuck,

You have two possibilities with a windows form application.
You can use the data tab in top of your program
You can add a new dataset item from your items
In a webform application (including webservice) you can add a dataset from
your items.

(All the connection and command methods etc. are now inside the strongly
typed dataset)

Be aware that those two kind of applications are now using the strongly
typed dataset in a different way.

Therefore if you have next time a question about this, tell than if it is
for a windowform or an Website, probably you have than more change on a
quick answer.

I hope this helps,

Cor
 
Thanks for the replies everyone..... however, I think I need to explain
more.

I want to take this application and run it on any database. I do not know
the structure of the db in advance (it is a stress test tool).
So.. the user might want to do "insert into table1(x, y, z) values ('x',
'y', 'z');" - I have supplied a text box for them to enter this SQL. I do
not know anything about the DB at design time.
They might also want to do a select, run an sp, etc, etc.

So, yes I can use the old components by adding them back into the toolbox
(which is what I have done). But that raises the question of why have they
been removed from the toolbox. Have they been removed because I can now do
this a different way? Why would MS remove something? Everybody who wants to
do something similar to this then has to add the old components back into
their toolbox. Also, since they have been removed, will they vanish
completely in future releases?

The problem with the new components seems to be that they are typed to a
particular db... which is fine of you know everything about the db at design
time.

Will
 
Cor, Thanks, but I was just lamenting the loss of drag and drop to the
windows form or web form pane from the server explorer. Many times, I have a
stored proc that I want to reference in a sql Command object (like a
executeScaler) and the drag/drop is way easier than using the tool box
command builder.

I use typed datasets all the time, but I fill them with a datareader. I
don't use the sqlAdapter very often becuase the vs2003 version did not work
with tables that had complex keys.

I'll check out the new datasets to see how the command and connections are
used...Chuck

:
 
Be sure to let us know how it goes--what works better, what not so well and
what's broken. Tell us what you discovered along the way.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top