Click here to Skip to main content
16,018,818 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Is the IF statement the best choice for this? Pin
Anonymous5-Jul-05 9:29
Anonymous5-Jul-05 9:29 
GeneralErrorProvider: Clear ALL Pin
Brad Fackrell5-Jul-05 9:07
Brad Fackrell5-Jul-05 9:07 
GeneralRe: ErrorProvider: Clear ALL Pin
Anonymous5-Jul-05 11:26
Anonymous5-Jul-05 11:26 
QuestionStringFormat.Format16bppArgb1555 ? Pin
[Marc]5-Jul-05 8:36
[Marc]5-Jul-05 8:36 
AnswerI mean PixelFormat.Format16bppArgb1555 Pin
[Marc]5-Jul-05 16:23
[Marc]5-Jul-05 16:23 
QuestionHow to Share data b/t parent and child form ? Pin
Madni Abbasi5-Jul-05 3:51
Madni Abbasi5-Jul-05 3:51 
AnswerRe: How to Share data b/t parent and child form ? Pin
Dave Kreskowiak5-Jul-05 5:47
mveDave Kreskowiak5-Jul-05 5:47 
GeneralVBscript to output SQL stored procedure results Pin
brokenchode5-Jul-05 3:23
brokenchode5-Jul-05 3:23 
I am calling a stored procedure in my vbscript and I need to be able to grab the results from the stored procedure execution. Right now I have tried several accessors, but nothing seems to be working. Also other methods I have seen done actually return fields from a table, the sql procedure I am executing is printing strings.

Does anyone know how to do this? Or any other thoughts how I could integrate this into my script?

TIA



VB CODE
-----

Dim dbnames_connection_jobs
Dim dbnames_command_jobs
Dim dbnames_recordset_jobs

Set dbnames_connection_jobs = CreateObject("ADODB.Connection")
Set dbnames_command_jobs = CreateObject("ADODB.Command")
Set dbnames_recordset_jobs = CreateObject("ADODB.Recordset")

dbnames_connection_jobs.ConnectionString = "Provider='sqloledb';Data Source='" & database_name & "';" & _
"Initial Catalog='master';Integrated Security='SSPI';"
dbnames_connection_jobs.open
dbnames_command_jobs.ActiveConnection = dbnames_connection_jobs
dbnames_command_jobs.CommandTimeout = 15



dbnames_command_jobs.CommandText = "exec sp_help_revlogin"
Set dbnames_recordset_jobs = dbnames_command_jobs.Execute

----

Stored Procedure
----
CREATE PROCEDURE sp_help_revlogin @login_name sysname = NULL AS
DECLARE @name sysname
DECLARE @xstatus int
DECLARE @binpwd varbinary (256)
DECLARE @txtpwd sysname
DECLARE @tmpstr varchar (256)
DECLARE @SID_varbinary varbinary(85)
DECLARE @SID_string varchar(256)

IF (@login_name IS NULL)
DECLARE login_curs CURSOR FOR
SELECT sid, name, xstatus, password FROM master..sysxlogins
WHERE srvid IS NULL AND name <> 'sa'
ELSE
DECLARE login_curs CURSOR FOR
SELECT sid, name, xstatus, password FROM master..sysxlogins
WHERE srvid IS NULL AND name = @login_name
OPEN login_curs
FETCH NEXT FROM login_curs INTO @SID_varbinary, @name, @xstatus, @binpwd
IF (@@fetch_status = -1)
BEGIN
PRINT 'No login(s) found.'
CLOSE login_curs
DEALLOCATE login_curs
RETURN -1
END
SET @tmpstr = '/* sp_help_revlogin script '
PRINT @tmpstr
SET @tmpstr = '** Generated '
+ CONVERT (varchar, GETDATE()) + ' on ' + @@SERVERNAME + ' */'
PRINT @tmpstr
PRINT ''
PRINT 'DECLARE @pwd sysname'
WHILE (@@fetch_status <> -1)
BEGIN
IF (@@fetch_status <> -2)
BEGIN
PRINT ''
SET @tmpstr = '-- Login: ' + @name
PRINT @tmpstr
IF (@xstatus & 4) = 4
BEGIN -- NT authenticated account/group
IF (@xstatus & 1) = 1
BEGIN -- NT login is denied access
SET @tmpstr = 'EXEC master..sp_denylogin ''' + @name + ''''
PRINT @tmpstr
END
ELSE BEGIN -- NT login has access
SET @tmpstr = 'EXEC master..sp_grantlogin ''' + @name + ''''
PRINT @tmpstr
END
END
ELSE BEGIN -- SQL Server authentication
IF (@binpwd IS NOT NULL)
BEGIN -- Non-null password
EXEC sp_hexadecimal @binpwd, @txtpwd OUT
IF (@xstatus & 2048) = 2048
SET @tmpstr = 'SET @pwd = CONVERT (varchar(256), ' + @txtpwd + ')'
ELSE
SET @tmpstr = 'SET @pwd = CONVERT (varbinary(256), ' + @txtpwd + ')'
PRINT @tmpstr
EXEC sp_hexadecimal @SID_varbinary,@SID_string OUT
SET @tmpstr = 'EXEC master..sp_addlogin ''' + @name
+ ''', @pwd, @sid = ' + @SID_string + ', @encryptopt = '
END
ELSE BEGIN
-- Null password
EXEC sp_hexadecimal @SID_varbinary,@SID_string OUT
SET @tmpstr = 'EXEC master..sp_addlogin ''' + @name
+ ''', NULL, @sid = ' + @SID_string + ', @encryptopt = '
END
IF (@xstatus & 2048) = 2048
-- login upgraded from 6.5
SET @tmpstr = @tmpstr + '''skip_encryption_old'''
ELSE
SET @tmpstr = @tmpstr + '''skip_encryption'''
PRINT @tmpstr
END
END
FETCH NEXT FROM login_curs INTO @SID_varbinary, @name, @xstatus, @binpwd
END
CLOSE login_curs
DEALLOCATE login_curs
RETURN 0

GO

---
GeneralRe: VBscript to output SQL stored procedure results Pin
Dave Kreskowiak5-Jul-05 5:56
mveDave Kreskowiak5-Jul-05 5:56 
GeneralRe: VBscript to output SQL stored procedure results Pin
brokenchode5-Jul-05 9:09
brokenchode5-Jul-05 9:09 
QuestionHow to update from vb.net 2005 beta1 to beta2? Pin
rushing4-Jul-05 23:02
rushing4-Jul-05 23:02 
AnswerRe: How to update from vb.net 2005 beta1 to beta2? Pin
Christian Graus5-Jul-05 0:13
protectorChristian Graus5-Jul-05 0:13 
AnswerRe: How to update from vb.net 2005 beta1 to beta2? Pin
Dave Kreskowiak5-Jul-05 1:18
mveDave Kreskowiak5-Jul-05 1:18 
GeneralGetting windows XP login &amp; logout time Pin
Ilangovan4-Jul-05 21:06
Ilangovan4-Jul-05 21:06 
GeneralRe: Getting windows XP login &amp; logout time Pin
Dave Kreskowiak5-Jul-05 1:13
mveDave Kreskowiak5-Jul-05 1:13 
GeneralRe: Getting windows XP login &amp; logout time Pin
Anonymous5-Jul-05 5:46
Anonymous5-Jul-05 5:46 
GeneralRe: Getting windows XP login &amp; logout time Pin
Anonymous5-Jul-05 8:23
Anonymous5-Jul-05 8:23 
GeneralHelp Pin
Nguyen Dinh Quy4-Jul-05 20:42
Nguyen Dinh Quy4-Jul-05 20:42 
GeneralRe: Help Pin
Christian Graus5-Jul-05 0:16
protectorChristian Graus5-Jul-05 0:16 
GeneralMSMQ Pin
nitin_ion4-Jul-05 20:30
nitin_ion4-Jul-05 20:30 
GeneralRe: MSMQ Pin
Dave Kreskowiak5-Jul-05 2:46
mveDave Kreskowiak5-Jul-05 2:46 
GeneralRe: MSMQ Pin
nitin_ion5-Jul-05 17:27
nitin_ion5-Jul-05 17:27 
GeneralRe: MSMQ Pin
Dave Kreskowiak6-Jul-05 1:00
mveDave Kreskowiak6-Jul-05 1:00 
GeneralRe: MSMQ Pin
nitin_ion6-Jul-05 18:27
nitin_ion6-Jul-05 18:27 
GeneralRe: MSMQ Pin
Dave Kreskowiak7-Jul-05 2:20
mveDave Kreskowiak7-Jul-05 2:20 

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.