Advertisement

05.21.2008 at 11:38AM PDT, ID: 23422013
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Calling a SQL SP from VB.NET and it fails on the .ExecutNonQuery method of my routine

Asked by wally_davis in SQL Server 2005

Tags: ,

I'm calling a SQL SP from VB.NET and it fails on the .ExecutNonQuery method of my routine.
Here's what I'm attempting to do
1. pull one piece of data out from the DB, i.e. from the Table/Column  Update.Status
2. Store the retrieve data value to a local vb.net variable
3. The other two conditions that must be compared, are the Network.Mac and the Uptime.mac (actual mac addresses that are pulled from our Main.Mac Main table/column) columns WHERE Network.Workstation = 'PCNAME'.
4. So, I'm trying to run the Stored Procedure from vb.net and trying to have that Stored Procedure (ADScan_CheckIfWkstnIsDisabled) return or OUTPUT the Update.Status value back to the vb code where it can then be stored in a variable and then have an If....Then condition will verify whether the variable contains the value 'Disabled', if it does, exit the While Loop and do nothing further. If the Value does not = 'Disabled' then update the database Uptime.Status column WHERE Network.Workstation_Name = 'PCNAME'. So, it sounds like I somehow need to get this data output sent back to me or somehow read.
The Error I'm getting is "InvalidOperationException was unhandled. String[1]: the Size property has an invalid size of 0."
I would appreciate someones help. Thanks,
WDStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
Below is both the SQL Stored Procedure and VB.NET Code:
--- SQL SP Code ---
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
 
ALTER PROCEDURE [dbo].[ADScan_CheckIfWkstnIsDisabled]
  @Workstation_Name varchar(MAX),
 @Status varchar(11) OUTPUT
AS
BEGIN
--  DECLARE @Status varchar(11)
--  Set @Status = 'Disabled'
  SELECT U.Status, N.Workstation_Name
  From Uptime U INNER JOIN Network N ON U.Mac=N.Mac
  WHERE U.Status = @Status And N.Workstation_Name = @Workstation_Name
END
--- VB.NET CODE ---
'Check first to see if the workstation is already disabled. If it is, exit While loop.
                        Dim cmdGetStatus As New SqlClient.SqlCommand("ADScan_CheckIfWkstnIsDisabled", sqlCon)
                        cmdGetStatus.CommandType = CommandType.StoredProcedure
                        'sqlCom.CommandText = "ADScan_CheckIfWkstnIsDisabled"
                        Dim parmStatus As SqlClient.SqlParameter = cmdGetStatus.CreateParameter
                        Dim parmWkstn As SqlClient.SqlParameter = cmdGetStatus.CreateParameter
                        With parmWkstn
                            .ParameterName = "@Workstation_Name"
                            .SqlDbType = SqlDbType.VarChar
                            .Direction = ParameterDirection.Input
                            .Value = host
                        End With
                        With parmStatus
                            .ParameterName = "@Status"
                            .SqlDbType = SqlDbType.VarChar
                            .Direction = ParameterDirection.Output
                        End With
                        cmdGetStatus.Parameters.Add(parmWkstn)
                        cmdGetStatus.Parameters.Add(parmStatus)
                        cmdGetStatus.ExecuteNonQuery()
 
                        Return (parmStatus)
[+][-]05.21.2008 at 11:41AM PDT, ID: 21617779

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 12:01PM PDT, ID: 21617982

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 12:03PM PDT, ID: 21618000

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 12:13PM PDT, ID: 21618091

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 12:22PM PDT, ID: 21618169

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 12:49PM PDT, ID: 21618412

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 01:25PM PDT, ID: 21618739

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 01:39PM PDT, ID: 21618856

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 01:44PM PDT, ID: 21618897

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 01:56PM PDT, ID: 21618979

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 02:32PM PDT, ID: 21619205

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.21.2008 at 03:01PM PDT, ID: 21619407

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.22.2008 at 01:39AM PDT, ID: 21621827

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Server 2005
Tags: SQL 2005, IE 7.0
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628