Click here to Skip to main content
16,005,037 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Odbc Procedure call problem Pin
Antebios115312-Jun-06 11:04
Antebios115312-Jun-06 11:04 
QuestionAutomating email send in vb.net Pin
Soundz12-Jun-06 10:49
Soundz12-Jun-06 10:49 
AnswerRe: Automating email send in vb.net Pin
Mekong River12-Jun-06 15:28
Mekong River12-Jun-06 15:28 
GeneralRe: Automating email send in vb.net Pin
Soundz14-Jun-06 9:51
Soundz14-Jun-06 9:51 
GeneralRe: Automating email send in vb.net Pin
Mekong River14-Jun-06 15:47
Mekong River14-Jun-06 15:47 
AnswerRe: Automating email send in vb.net Pin
amiableuser13-Jun-06 19:56
amiableuser13-Jun-06 19:56 
GeneralRe: Automating email send in vb.net Pin
Soundz14-Jun-06 9:55
Soundz14-Jun-06 9:55 
QuestionOdbc stored procedure problem Pin
Antebios115312-Jun-06 9:31
Antebios115312-Jun-06 9:31 
Hello all, I need a little help. I'm calling a stored procedure from my
vb.net prog and I keep getting a syntax error. Could someone look at my code
and help me out a little. Thanks in advance.

Here is the procedure:

AddMember:

if exists (select * from sysobjects where id = object_id('dbo.AddMember')
and sysstat & 0xf = 4)
drop procedure dbo.AddMember
GO

CREATE PROCEDURE AddMember
@mbr_acctnum decimal(12,0),
@mbr_name varchar(50),
@mbr_ssn varchar(9),
@mbr_employee char(1)

AS
INSERT INTO Members (Account_Number, Member_Name, Social_Security_Number,
Employee)
VALUES (@mbr_acctnum, @mbr_name, @mbr_ssn, @mbr_employee)
GO

Here is the code:

'Create the ODBC objects
Dim OdbcCon As System.Data.Odbc.OdbcConnection
Dim OdbcCmd As System.Data.Odbc.OdbcCommand
'Instantiate new instances
OdbcCon = New System.Data.Odbc.OdbcConnection
OdbcCmd = New System.Data.Odbc.OdbcCommand

'Open a connection to an iSeries data source
OdbcCon.ConnectionString = _
"Driver={SQL Server};Server=" & _
pserver & ";Database=" & database & _
";Uid=" & puserid & "pwd=" & password

'Set up the procedure call
OdbcCmd.CommandText = "AddMember"
OdbcCmd.CommandType = CommandType.StoredProcedure
'Accosicate the command with the connection
OdbcCmd.Connection = OdbcCon
'Open the connection
OdbcCon.Open()
'Create the parameter objects to pass and get data from procedure
OdbcCmd.Parameters.Add("@mbr_acctnum", Odbc.OdbcType.Decimal, _
12, 0).Direction = ParameterDirection.Input
OdbcCmd.Parameters.Add("@mbr_name", Odbc.OdbcType.VarChar, _
50).Direction = ParameterDirection.Input
OdbcCmd.Parameters.Add("@mbr_ssn", Odbc.OdbcType.VarChar, _
9).Direction = ParameterDirection.Input
OdbcCmd.Parameters.Add("@mbr_employee", Odbc.OdbcType.Char, _
1).Direction = ParameterDirection.Input
'set the value of the parms to pass
OdbcCmd.Parameters(0).Value = 12
OdbcCmd.Parameters(1).Value = "xxxx wwww"
OdbcCmd.Parameters(2).Value = "444229999"
OdbcCmd.Parameters(3).Value = "Y"
'call the procedure
OdbcCmd.ExecuteNonQuery()
'put the results into a textbox control
'txtResult.Text = OdbcCmd.Parameters(1).Value
'close the connection
OdbcCon.Close()

Here is the error I receive:

MSSQLJOB 964-9a4 EXIT SQLExecDirectW with return code -1
(SQL_ERROR)
HSTMT 03A31BC0
WCHAR * 0x010C08E8 [ -3] "AddMember\ 0"
SDWORD -3

DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure
AddMember expects parameter @mbr_acctnum, which was not supplied. (201)

DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure
AddMember expects parameter @mbr_name, which was not supplied. (201)

DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure
AddMember expects parameter @mbr_ssn, which was not supplied. (201)

DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure
AddMember expects parameter @mbr_employee, which was not supplied. (201)

Any help appreciated.

AnswerRe: Odbc stored procedure problem Pin
Dave Kreskowiak13-Jun-06 1:56
mveDave Kreskowiak13-Jun-06 1:56 
QuestionDatabase Pin
nkcsoft12-Jun-06 8:57
nkcsoft12-Jun-06 8:57 
AnswerRe: Database Pin
Mekong River12-Jun-06 15:32
Mekong River12-Jun-06 15:32 
QuestionCrystal Reports Running Total [modified] STILL NEED HELP Pin
Kschuler12-Jun-06 8:20
Kschuler12-Jun-06 8:20 
AnswerRe: Crystal Reports Running Total Pin
Mekong River12-Jun-06 15:35
Mekong River12-Jun-06 15:35 
GeneralRe: Crystal Reports Running Total Pin
Kschuler13-Jun-06 2:56
Kschuler13-Jun-06 2:56 
GeneralDisable Windows FormsTitlebar Double Click Pin
Hanika12-Jun-06 7:54
Hanika12-Jun-06 7:54 
QuestionSoftware Protection Pin
moldie12-Jun-06 5:28
moldie12-Jun-06 5:28 
AnswerRe: Software Protection Pin
Mekong River12-Jun-06 15:37
Mekong River12-Jun-06 15:37 
GeneralRe: Software Protection [modified] Pin
moldie13-Jun-06 0:39
moldie13-Jun-06 0:39 
GeneralRe: Software Protection Pin
Mekong River14-Jun-06 16:05
Mekong River14-Jun-06 16:05 
Questiondo you have vb.net QuickFillDemo_src Pin
a49702398612-Jun-06 3:20
a49702398612-Jun-06 3:20 
Questioncrystal report Pin
jith - iii12-Jun-06 3:16
jith - iii12-Jun-06 3:16 
AnswerRe: crystal report Pin
Mekong River12-Jun-06 15:39
Mekong River12-Jun-06 15:39 
GeneralRe: crystal report Pin
jith - iii12-Jun-06 17:52
jith - iii12-Jun-06 17:52 
GeneralRe: crystal report Pin
Mekong River14-Jun-06 15:51
Mekong River14-Jun-06 15:51 
QuestionCrashed users v Active users Pin
daveryan7812-Jun-06 1:26
daveryan7812-Jun-06 1:26 

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.