Click here to Skip to main content
15,887,596 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Persistant DataSet data entry problem Pin
Marcus J. Smith21-May-07 7:35
professionalMarcus J. Smith21-May-07 7:35 
GeneralRe: Persistant DataSet data entry problem Pin
Quecumber25621-May-07 8:08
Quecumber25621-May-07 8:08 
GeneralRe: Persistant DataSet data entry problem Pin
Marcus J. Smith21-May-07 8:28
professionalMarcus J. Smith21-May-07 8:28 
GeneralRe: Persistant DataSet data entry problem Pin
Quecumber25621-May-07 9:21
Quecumber25621-May-07 9:21 
QuestionDeath by obfuscation! Pin
Rich Leyshon21-May-07 5:28
Rich Leyshon21-May-07 5:28 
AnswerRe: Death by obfuscation! Pin
sthotakura21-May-07 11:02
sthotakura21-May-07 11:02 
GeneralRe: Death by obfuscation! Pin
Rich Leyshon21-May-07 11:10
Rich Leyshon21-May-07 11:10 
QuestionSQL UPDATE Stored Procedure in VB Not Working Pin
tommyfs21-May-07 4:44
tommyfs21-May-07 4:44 
My program is patterned after the excellent article by Sujith C. Jose entitled "How to use Stored Procedures in VB6." My stored procedure follows:

CREATE PROCEDURE empdetails (@empid varchar(9), @lastname varchar(18),
@firstname varchar(18), @deptno varchar(30), @deptname varchar(30))
AS
UPDATE sysadm.table001
SET I0013=@firstname
WHERE I0010 = @empid
GO

My VB6 code(edited) is:

Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As ADODB.Command
Dim str_empid As String, strconnect As String
Dim lastname As String, firstname As String, deptno As String, deptname As String
Dim str_lastname As String, str_firstname As String, str_deptno As String, str_deptname As String

Private Sub Form_Load()
strconnect = "Provider=SQLOLEDB; Data Source=esp; Initial Catalog=DMTESTDB"
con.Open strconnect, "sysadm", "sysadm"
str_empid = Field0
str_lastname = Field1
str_firstname = Field2
str_deptno = Field3
str_deptname = Field4

Set cmd = New ADODB.Command
cmd.ActiveConnection = con
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "empdetails"

cmd.Parameters.Append cmd.CreateParameter("empid", adVarChar, adParamInput, 9, str_empid)
cmd.Parameters.Append cmd.CreateParameter("lastname", adVarChar, adParamInput, 18, str_lastname)
cmd.Parameters.Append cmd.CreateParameter("firstname", adVarChar, adParamInput, 18, str_firstname)
cmd.Parameters.Append cmd.CreateParameter("deptno", adVarChar, adParamInput, 30, str_deptno)
cmd.Parameters.Append cmd.CreateParameter("deptname", adVarChar, adParamInput, 30, str_deptname)

Set rs = cmd.Execute

Set cmd.ActiveConnection = Nothing
con.Close

End Sub

My stored procedure works fine in SQL Query Analyzer; I believe my database DMTESTDB opens correctly w/o error (because if I change the password, I generate an error message); and in the cmd.Parameters.Append section, the str_ variables are correctly filled from a part of the program not shown. The cmd.Execute statement runs, but does not result in a successful Update of the database table. (I did "grant" the EXEC permission in my SP for that password).

What am I missing here? I'm stumped.


AnswerRe: SQL UPDATE Stored Procedure in VB Not Working Pin
Dave Herren21-May-07 5:36
Dave Herren21-May-07 5:36 
AnswerRe: SQL UPDATE Stored Procedure in VB Not Working Pin
tommyfs24-May-07 13:18
tommyfs24-May-07 13:18 
Questionhow to find out rowindex in datagrid's drop-event? Pin
Smithers-Jones21-May-07 4:08
Smithers-Jones21-May-07 4:08 
AnswerRe: how to find out rowindex in datagrid's drop-event? Pin
Smithers-Jones21-May-07 21:58
Smithers-Jones21-May-07 21:58 
QuestionDate Format question Pin
No-e21-May-07 3:42
No-e21-May-07 3:42 
AnswerRe: Date Format question Pin
No-e21-May-07 4:02
No-e21-May-07 4:02 
Questionwats wrong in this Pin
balakpn21-May-07 3:42
balakpn21-May-07 3:42 
AnswerRe: wats wrong in this Pin
Dave Kreskowiak21-May-07 4:21
mveDave Kreskowiak21-May-07 4:21 
GeneralRe: wats wrong in this Pin
balakpn22-May-07 1:43
balakpn22-May-07 1:43 
GeneralRe: wats wrong in this Pin
Dave Kreskowiak22-May-07 12:08
mveDave Kreskowiak22-May-07 12:08 
GeneralRe: wats wrong in this Pin
balakpn22-May-07 18:29
balakpn22-May-07 18:29 
GeneralRe: wats wrong in this Pin
Dave Kreskowiak23-May-07 15:34
mveDave Kreskowiak23-May-07 15:34 
QuestionHow can I prevent DataGridView validation events when exiting the application? Pin
Marcus J. Smith21-May-07 3:38
professionalMarcus J. Smith21-May-07 3:38 
AnswerRe: How can I prevent DataGridView validation events when exiting the application? Pin
Dave Kreskowiak21-May-07 10:13
mveDave Kreskowiak21-May-07 10:13 
GeneralRe: How can I prevent DataGridView validation events when exiting the application? Pin
Marcus J. Smith21-May-07 10:38
professionalMarcus J. Smith21-May-07 10:38 
GeneralRe: How can I prevent DataGridView validation events when exiting the application? Pin
hairy_hats14-Jul-09 1:01
hairy_hats14-Jul-09 1:01 
Questionget hte data from the database Pin
sanapathi21-May-07 3:35
sanapathi21-May-07 3:35 

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.