O
Omar
Hi All,
I have a headache with SQL Server and .net application which I hope you
can help with.
I have this trigger on my table 'tester' in sql server 2000. It calls
the external program exetest
CREATE TRIGGER testTrig ON [dbo].[tester]
FOR INSERT, UPDATE
AS
exec master..xp_cmdShell 'C:\ExeTest.exe'
I am calling the ExeTest.exe program which is supposed to read from the
same table again and just display first.
I am having a similar problem as this guy below( i.e updating and
reading the same table. But there is no solution)
http://groups.google.com/group/micr...expired+sqldatareader&rnum=1#0494ca46ee4147bb
Is there a way that I can achieve this? Even if it is long, I do not
mind as long as there is no timeout. I have set the timeout to 5
minutes plus, and still got a timeout error. It seems the table is
locked and cannot be selected from???
If you still reading, here is my code in the ExeTest.exe
Sub Main()
Dim sqlstring As String = "select * from tester"
'Dim connString1 As String = "Data
Source=servername;Database=ProjectServer;UID=sa;pwd=pwd"
Dim connString1 As String = "Data
Source=localhost;Database=ProjectServer;Integrated Security=true"
Dim conn As New SqlConnection
conn = New SqlConnection(connString1)
Try
conn.Open()
Dim cmd As New SqlCommand(sqlstring, conn)
cmd.CommandTimeout = 40
Dim listA As SqlDataReader = cmd.ExecuteReader()
While listA.Read
Console.WriteLine(listA(1))
End While
'End If
listA.Close()
conn.Close()
Catch ex As Exception
Console.WriteLine("error : " + ex.Message)
End Try
End Sub
Regards,
Omar
I have a headache with SQL Server and .net application which I hope you
can help with.
I have this trigger on my table 'tester' in sql server 2000. It calls
the external program exetest
CREATE TRIGGER testTrig ON [dbo].[tester]
FOR INSERT, UPDATE
AS
exec master..xp_cmdShell 'C:\ExeTest.exe'
I am calling the ExeTest.exe program which is supposed to read from the
same table again and just display first.
I am having a similar problem as this guy below( i.e updating and
reading the same table. But there is no solution)
http://groups.google.com/group/micr...expired+sqldatareader&rnum=1#0494ca46ee4147bb
Is there a way that I can achieve this? Even if it is long, I do not
mind as long as there is no timeout. I have set the timeout to 5
minutes plus, and still got a timeout error. It seems the table is
locked and cannot be selected from???
If you still reading, here is my code in the ExeTest.exe
Sub Main()
Dim sqlstring As String = "select * from tester"
'Dim connString1 As String = "Data
Source=servername;Database=ProjectServer;UID=sa;pwd=pwd"
Dim connString1 As String = "Data
Source=localhost;Database=ProjectServer;Integrated Security=true"
Dim conn As New SqlConnection
conn = New SqlConnection(connString1)
Try
conn.Open()
Dim cmd As New SqlCommand(sqlstring, conn)
cmd.CommandTimeout = 40
Dim listA As SqlDataReader = cmd.ExecuteReader()
While listA.Read
Console.WriteLine(listA(1))
End While
'End If
listA.Close()
conn.Close()
Catch ex As Exception
Console.WriteLine("error : " + ex.Message)
End Try
End Sub
Regards,
Omar