Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
JHCOLVI
Starting Member
13 Posts |
Posted - 2005-06-02 : 12:41:58
|
| I need to make tables, insert data, and delete tables from visual basic 6.0 to a SQL 7.0 database. Can I use dynmaic SQL and execute it from inside my visual basic progam? If it is possible, does anyone know of any books that might sample coding for this? |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2005-06-02 : 12:47:34
|
quote: Originally posted by JHCOLVI I need to make tables, insert data, and delete tables from visual basic 6.0 to a SQL 7.0 database. Can I use dynmaic SQL and execute it from inside my visual basic progam?
Yesquote: If it is possible, does anyone know of any books that might sample coding for this?
NoWhy don't you just do this in sql server? Dynamic sql, at the extent that you plan to use it, would not be a good idea ofr an applicationIf you want to do this for administrative purposes, then you'd be much better served using sql server client tools like Enterprise Manager and Query Analyzer.Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
JHCOLVI
Starting Member
13 Posts |
Posted - 2005-06-02 : 13:48:51
|
| I would love to use sql server, but make my program does other items that do not involve a database and already are programed by visual basic. Also the program runs automaticly. If you don't know of any books, is there a webpage that make have some sample coding? |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-06-02 : 13:51:54
|
quote: but make my program does other items that do not involve a database and already are programed by visual basic
Well, if it does things that are do not involve a database, why add database functionality to it? The point Brett is making is that using dynamic SQL is not the best way to provide these features, and from what you've described these features don't even sound like a good idea to add. |
 |
|
|
raclede
Posting Yak Master
180 Posts |
Posted - 2005-06-02 : 20:20:30
|
' for VB6 Hmmm.. its seems to hard for me to remember cause Im not using C#, but the code looks like this:Dim myCon As New ConnectionDim myRs As New RecordsetPrivate Sub Form_Load()Dim myDynamicSQL As StringDim iID As IntegerDim sYourOrdering As StringDim ctr As IntegermyCon.Open "Provider=sqloledb;" & _"Data Source=IPAddress/DSN of SQL;" & _"Initial Catalog=DataBaseName;" & _"Uid=UserName;" & _"Pwd=Password" myDynamicSQL = "SELECT * FROM YourTable WHERE YourID = " & iID & _ " ORDER BY " & sYourOrdering Set myRs = myCon.Execute(myDynamicSQL) While Not myRs.EOF For ctr = 0 To myRs.Fields - 1 MsgBox myRs(ctr) Next myRs.MoveNext WendEnd Sub"If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year, killing everyone inside. " raclede |
 |
|
|
raclede
Posting Yak Master
180 Posts |
Posted - 2005-06-02 : 20:22:22
|
[quote]Originally posted by raclede 'not using C#, [quote]Should be [b]now[b]"If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year, killing everyone inside. " raclede |
 |
|
|
|
|
|
|
|