Stored Procedure Results

  • Thread starter Thread starter Kait
  • Start date Start date
K

Kait

I have a stored procedure which is as follows:

Alter Procedure "uspConfig"

(
@FO int,
@Pull varchar(4)
)
As
DELETE FROM tblEEConfig
INSERT INTO tblEEConfig
SELECT FO, Pull, Config, StartSNRange FROM tblSerialNum WHERE FO = @FO
AND Pull = @Pull;

This proc will only return one record. I would like to display the
Config and StartSNRange in a text box on a .net form.

After trying the .executereader method, the .parameter.add method and a
few others this is the code I am trying in a button click event:

Dim dsResults As String
Dim dsStartResults As String
dsResults = daEEConfig.Fill(DsEEConfig1).ToString
dsStartResults = daEEConfigStart.Fill(DsEEConfigStart1).ToString
txtFileLoc.Text = txtFileLoc.Text & dsResults & "\" & dsStartResults

I feel that I am way off the mark with this, but as it is, I have
already spent too much time trying to get this accomplished. Any
suggestions, either for the proc or the .net code, would be greatly
appreciated! Thanks!
 
The main problem is you need to choose a methodology. If you're going to use
Adapter.Fill - then you don't need ExecuteReader and vice versa.

For parameters - do you have something like this

cmd.Parameters.Add("@FO", SqlDbType.Int);
cmd.Parameters.Add("@Pull", SqlDbType.Varchar, 50);

cmd.Parameters["@FO"].Value = Whatever;
cmd.Parameters["@Pull"].Value = whaateverelse;

As far as setting a DataSet's ToString() representation to a string - that
definitely isn't the way to go... it should probably be da.Fill(myDataSet,
"SomeTable");

dsResults = myDataSet.Tables["SomeTable"].Rows[0][ColumnIndex]...
 
Thanks for giving me some direction! I still have a few kinks to work
out, but I am a lot closer! I used the following code based on your
suggestion:

Dim dsResults As String
Dim dsStartResults As String

daEEConfig.Fill(DsEEConfig1, "tblEEConfig")
daEEConfigStart.Fill(DsEEConfigStart1, "tblEEConfig")

dsStartResults = DsEEConfigStart1.Tables(0).Rows(0).Item(0)
dsResults = DsEEConfig1.Tables(0).Rows(0).Item(0)
Thanks again!!
 
Your welcome - let me know if you get stuck though and I'll do what I can to
help you.
 

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

Back
Top