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.

 All Forums
 Development Tools
 ASP.NET
 Running Complex Stored procidures

Author  Topic 

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2009-09-03 : 13:36:22
Plain an simple I am no web developer but I need to make a few Web pages to support some mobile applications.

It seems like as soon as Stored procidures get complex the will not run through the web.

Example I have a stored procidure that starts a Quality Var instance.
(The Procidure is tested and works with the same inputs Used later)

ALTER PROCEDURE [dbo].[WC_StartQvarCust] @Job_Number_Sub_Link int,@Department varchar(50),@DQV Varchar(1000)

AS
BEGIN

SET NOCOUNT ON;

Declare @QVID int

Insert into dbo.QualityVarheader
(Job_Number_Sub_Link)
Select @Job_Number_Sub_Link

Select @QVID = MAX(qvid)
From dbo.QualityVarheader

Insert Into dbo.QualityVarDetail
(QVID,Job_Number_Sub_Link,DQV,Department)
Select @QVID,@Job_Number_Sub_Link,@DQV,@Department

END

Now to call it I just put a test button on a page and preloaded the Variables (they would come from the page form but I just wanted to get it to work first.)


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SJB As Int32
Dim Dept As String
Dim DOV As String

SJB = "555555"
Dept = "My Department"
DOV = " Beam me up scotty there is no inteligent life on this planet "

Dim connectionString As String = _
"Integrated Security=True;" + _
"Initial Catalog=MasterPCS;Data Source=Serverone"


Dim connection As SqlConnection = _
New SqlConnection(connectionString)
connection.Open()

Dim command As SqlCommand = _
New SqlCommand("WC_StartQvarCust", connection)
command.CommandType = CommandType.StoredProcedure

command.Parameters.AddWithValue("@Job_Number_Sub_Link", SJB)
command.Parameters.AddWithValue("@Department", Dept)
command.Parameters.AddWithValue("@DQV", DOV)

connection.Close()

TextBox1.Text = DOV
End Sub


But It does not work nor does it give any errors
(My design tool is VS 2008)

Any Ideas?

Am I going about this wrong?


Jim
Users <> Logic
   

- Advertisement -