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 |
|
sign_in
Starting Member
2 Posts |
Posted - 2005-08-23 : 13:51:52
|
HiI would like to create and run a stored procedure from VB. I will pass a variable to the stored procedure and after that according to the parameter, records are selected and shown in the DB grid on the form.. I'm using VB 5 and mssql 2000. I have to show selective data in the DB Grid. Any suggestions and help are welcomed. Thanks in advance. |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2005-08-23 : 14:15:45
|
| Surely you don't mean that you want to CREATE the stored procedure from VB, do you? I presume you mean that you want to create a reference to a procedure that has already been created in the SQL Server. OK, so then you need to create a ADODB.Connection, and probably an ADODB.Command object would be useful, for passing the parameter to the procedure. And probably and ADODB.Recordset object for retrieving the results.Are you REALLY using VB 5? I'd think if you're running SQL 2000, you'd probably have upgraded at least to VB 6 by now.---------------------------EmeraldCityDomains.com |
 |
|
|
sign_in
Starting Member
2 Posts |
Posted - 2005-08-23 : 15:12:09
|
:( Yes I did. The problem I am having is how to write a stored procedure that will perform select, create a table and show the data in the DB grid when I call it from VB. yes, vb 6. How can I show selective data in DB grid by using a stroed procedure?tks alot for your prompt reply. |
 |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2005-08-23 : 16:05:58
|
| CREATING the stored procedure and using it to display data in the DB Grid are two very different things. Are you saying that you need to dynamically, on the fly, based on some changing information, CREATE a new stored procedure from your VB? Or are you just having trouble with the syntax and where to do it? If the former, I would seriously question your need to do that as it reeks of headaches. If simply the latter, then I would encourage you to read the SQL Server Books Online (a.k.a. BOL) that comes with SQL Server, and is also available online at the Microsoft web site and look up the topic CREATE PROCEDURE. You would do that preferably in Query Analyzer, but could also do it in Enterprise Manager (these are the standard client tools for SQL Server).Then once you have it created, you EXECUTE it from your VB code using the objects I mentioned before. You can either use Databinding in VB6 or you can populate the DB Grid manually, using its commands (which I would assume would be something like myGrid.Add ...If the above is all sounding like a foreign language, you might want to go shopping for a book or two. The .NET ones are far more common these days, but you should still be able to find a VB6 with SQL Server book. ---------------------------EmeraldCityDomains.com |
 |
|
|
|
|
|
|
|