Click here to Skip to main content
15,845,936 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: MySql connector problem Pin
JayKhatri17-May-09 22:40
JayKhatri17-May-09 22:40 
QuestionWeb setup project fails in Windows vista and IIS7 Pin
Muhammad Sohaib Yousaf15-May-09 3:12
Muhammad Sohaib Yousaf15-May-09 3:12 
AnswerRe: Web setup project fails in Windows vista and IIS7 Pin
Dave Kreskowiak15-May-09 5:11
mveDave Kreskowiak15-May-09 5:11 
QuestionFinding IP Address of Device Connected To PC via LAN Cable. Pin
VikashGohil14-May-09 22:43
VikashGohil14-May-09 22:43 
AnswerRe: Finding IP Address of Device Connected To PC via LAN Cable. Pin
Dave Kreskowiak15-May-09 5:12
mveDave Kreskowiak15-May-09 5:12 
GeneralRe: Finding IP Address of Device Connected To PC via LAN Cable. Pin
VikashGohil16-May-09 22:42
VikashGohil16-May-09 22:42 
GeneralRe: Finding IP Address of Device Connected To PC via LAN Cable. Pin
Dave Kreskowiak17-May-09 4:27
mveDave Kreskowiak17-May-09 4:27 
Question[RESOLVED] Trying to use smo to create an insert stored proc which returns identity [modified] Pin
bobishkindaguy14-May-09 15:12
bobishkindaguy14-May-09 15:12 
I'm trying to use smo to create an insert stored proc which returns the identity of the newly created row.

Here's my code, which returns a "create failed" message without other relevant details.

(The mMyDatabase reference in the code is a Microsoft.SqlServer.Management.Smo.Database that has been successfully connected to. I can post the code for that part if you need it.)

Public Sub AddInsertActivityStoredProcedure()
    Dim Name As String = "InsertActivityRow"
    If mMyDatabase.StoredProcedures.Contains(Name) Then
      mMyDatabase.StoredProcedures(Name).Drop()
    End If

    Dim An_SP As New StoredProcedure(mMyDatabase, Name, "dbo")

    'An_SP.TextHeader = "???"
    An_SP.TextMode = False
    An_SP.AnsiNullsStatus = False
    An_SP.QuotedIdentifierStatus = False

    An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@UserFK", DataType.Int))
    An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@MachineFK", DataType.Int))
    An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@ActivityDate", DataType.Int))
    An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@Activity", DataType.Int))
    An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@TableAffected", DataType.Int))
    An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@RowAffected", DataType.Int))
    An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@NewPK", DataType.Int))

    An_SP.TextBody = "set nocount on" + NewLine
    An_SP.TextBody = "INSERT INTO [ADV4SQL].[dbo].[ADVActivities]"
    An_SP.TextBody += " ([AcUserFK]"
    An_SP.TextBody += " ,[AcMachineFK]"
    An_SP.TextBody += " ,[AcDate]"
    An_SP.TextBody += " ,[AcActivity]"
    An_SP.TextBody += " ,[AcTableAffected]"
    An_SP.TextBody += " ,[AcRowAffected])"
    An_SP.TextBody += " VALUES"
    An_SP.TextBody += " (@UserFK"
    An_SP.TextBody += " ,@MachineFK,"
    An_SP.TextBody += " ,@ActivityDate, "
    An_SP.TextBody += " ,@Activity, "
    An_SP.TextBody += " ,@TableAffected, "
    An_SP.TextBody += " ,@RowAffected, )" + NewLine
    An_SP.TextBody += "@NewPK= SCOPE_IDENTITY() " + NewLine
    An_SP.Create()

  End Sub


modified on Sunday, May 17, 2009 4:41 PM

AnswerRe: Trying to use smo to create an insert stored proc which returns identity Pin
Dave Kreskowiak15-May-09 5:15
mveDave Kreskowiak15-May-09 5:15 
GeneralRe: Trying to use smo to create an insert stored proc which returns identity Pin
led mike15-May-09 10:21
led mike15-May-09 10:21 
AnswerRe: Trying to use smo to create an insert stored proc which returns identity Pin
bobishkindaguy15-May-09 7:28
bobishkindaguy15-May-09 7:28 
GeneralRe: Trying to use smo to create an insert stored proc which returns identity Pin
Dave Kreskowiak15-May-09 13:05
mveDave Kreskowiak15-May-09 13:05 
QuestionRe: Trying to use smo to create an insert stored proc which returns identity [modified] Pin
bobishkindaguy17-May-09 10:39
bobishkindaguy17-May-09 10:39 
AnswerRe: Trying to use smo to create an insert stored proc which returns identity Pin
bobishkindaguy17-May-09 11:57
bobishkindaguy17-May-09 11:57 
Questiontool text gdi+ Pin
ramaluciano14-May-09 5:59
ramaluciano14-May-09 5:59 
QuestionClickOnce and Sandbox? Pin
Atul Kharecha14-May-09 1:50
Atul Kharecha14-May-09 1:50 
Questionsplitting in VB.NET without delimiters Pin
poojapande14-May-09 0:06
poojapande14-May-09 0:06 
AnswerRe: splitting in VB.NET without delimiters Pin
Pete O'Hanlon14-May-09 0:24
subeditorPete O'Hanlon14-May-09 0:24 
GeneralRe: splitting in VB.NET without delimiters Pin
Luc Pattyn14-May-09 2:33
sitebuilderLuc Pattyn14-May-09 2:33 
AnswerRe: splitting in VB.NET without delimiters Pin
Fernando Soto14-May-09 9:28
Fernando Soto14-May-09 9:28 
QuestionDisable "Print" & "Save As" Options From Moss 2007 document Library Pin
Kronfolitto13-May-09 23:12
Kronfolitto13-May-09 23:12 
QuestionLink error with C++ code with Intel fortran code. Pin
lavate malllik13-May-09 22:47
lavate malllik13-May-09 22:47 
QuestionBootstrapper Pin
netDeveloper13-May-09 22:45
netDeveloper13-May-09 22:45 
AnswerRe: Bootstrapper Pin
netDeveloper13-May-09 23:50
netDeveloper13-May-09 23:50 
GeneralRe: Bootstrapper Pin
netDeveloper14-May-09 2:51
netDeveloper14-May-09 2:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.