Click here to Skip to main content
15,888,239 members
Home / Discussions / Database
   

Database

 
GeneralRe: Login Pin
Desi Bravo3-Jul-05 4:37
Desi Bravo3-Jul-05 4:37 
GeneralRe: Login Pin
Christian Graus3-Jul-05 11:31
protectorChristian Graus3-Jul-05 11:31 
GeneralRe: Login Pin
Anonymous3-Jul-05 16:25
Anonymous3-Jul-05 16:25 
GeneralRe: Login Pin
Christian Graus3-Jul-05 16:36
protectorChristian Graus3-Jul-05 16:36 
Generalreplace function Pin
Anonymous30-Jun-05 15:45
Anonymous30-Jun-05 15:45 
GeneralRe: replace function Pin
Michael Potter1-Jul-05 10:45
Michael Potter1-Jul-05 10:45 
GeneralInsert Record into Database. What is wrong? Urgent. Thank You. Pin
shapper30-Jun-05 10:49
shapper30-Jun-05 10:49 
GeneralSelect command won't work after Insert command in stored procedure Pin
jchsiung230-Jun-05 10:15
jchsiung230-Jun-05 10:15 
Confused | :confused:
1. If you use SQL Query Analyer
Exec InsertTable2
Everything works fine.

2. If you use ADO to call stored procedure, as following code, the data will be inserted into the table; but you got empty recordsets returned.

3. If you comment out the Insert statement in the stored procedure, you will get all the recordsets returned. So the Select statement works.

4. This has nothing to do with the permission. Even with sa account, it behaves the same.

5. Does any one know why the Insert statement will block Select statement during ADO call?

----------------------------------------------------------

Create PROCEDURE [InsertTable2]

AS

INSERT INTO Table2 ( field1, field2) VALUES ('1', '2')

Select * From Table2

GO

The VB code to call this procedure

Confused | :confused: Private Sub cmdInsert2_Click()

Dim sSQL As String
Dim rs As ADODB.Recordset

Dim oCommand As ADODB.Command
Dim rStr As String
Dim index2 As Integer


Set oCommand = New ADODB.Command
sSQL = "InsertTable2"

With oCommand
.CommandType = adCmdStoredProc
.CommandText = sSQL
.ActiveConnection = cn

End With

Set rs = oCommand.Execute


Do While (Not rs Is Nothing)
If rs.State = adStateClosed Then
Debug.Print "Returned recordset is empty"

Exit Do
End If

Debug.Print "----------------------"

While Not rs.EOF
rStr = ""

For index2 = 0 To rs.Fields.Count - 1
If index2 = 0 Then
rStr = rs(index2)
Else
rStr = rStr & ", " & rs(index2)
End If
Next index2

Debug.Print rStr

rs.MoveNext
Wend
Set rs = rs.NextRecordset
Loop


Exit Sub

End Sub


GeneralRe: Select command won't work after Insert command in stored procedure Pin
Scott Serl30-Jun-05 12:33
Scott Serl30-Jun-05 12:33 
GeneralRe: Select command won't work after Insert command in stored procedure Pin
jchsiung25-Jul-05 7:28
jchsiung25-Jul-05 7:28 
Generalproduct studio Pin
ziczaczoom200430-Jun-05 7:39
ziczaczoom200430-Jun-05 7:39 
GeneralMSDE slowing down Pin
Luis Alonso Ramos30-Jun-05 6:50
Luis Alonso Ramos30-Jun-05 6:50 
GeneralRe: MSDE slowing down Pin
Colin Angus Mackay30-Jun-05 7:10
Colin Angus Mackay30-Jun-05 7:10 
GeneralRe: MSDE slowing down Pin
Luis Alonso Ramos30-Jun-05 7:29
Luis Alonso Ramos30-Jun-05 7:29 
GeneralReplication Pin
skrishnasarma29-Jun-05 23:28
skrishnasarma29-Jun-05 23:28 
GeneralRe: Replication Pin
StylezHouse30-Jun-05 2:53
StylezHouse30-Jun-05 2:53 
GeneralUnsigned numbers Pin
Jack Puppy29-Jun-05 11:44
Jack Puppy29-Jun-05 11:44 
GeneralRe: Unsigned numbers Pin
toxcct30-Jun-05 6:25
toxcct30-Jun-05 6:25 
GeneralArchitecture question Pin
klenne29-Jun-05 1:37
klenne29-Jun-05 1:37 
GeneralRe: Architecture question Pin
StylezHouse29-Jun-05 2:25
StylezHouse29-Jun-05 2:25 
GeneralRe: Architecture question Pin
Mattias Olgerfelt29-Jun-05 4:45
Mattias Olgerfelt29-Jun-05 4:45 
GeneralRe: Architecture question Pin
toxcct30-Jun-05 6:32
toxcct30-Jun-05 6:32 
GeneralT-SQL Pin
98022829-Jun-05 1:20
suss98022829-Jun-05 1:20 
GeneralRe: T-SQL Pin
StylezHouse29-Jun-05 2:30
StylezHouse29-Jun-05 2:30 
GeneralRe: T-SQL Pin
Alsvha29-Jun-05 4:04
Alsvha29-Jun-05 4:04 

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.