P
Panda
Hi All,
Any help greatly appreciated before I finish pulling the rest of my
hair out.
I'm making a program that allows a user to record their hours. There
are five rows (monday to friday). When a user clicks submit the
programme checks if the row has got user data. If it does it checks if
that day already has data held against it and then does an update or
insert accordingly.
It is all working apart from when the program comes to check the
second day it times out on the command. That command run in query
analyser works fine. The function that carries out the check is
Function CheckInsUpd(ByVal userID As Integer, ByVal inputDate As
String) As Integer
Try
Dim sqlCheckConn As New SqlConnection(strConn)
Dim strcheckSQL As String = "select count(detailID) from
flexiDetail where userID = @uID and flexiDate = @fDate"
sqlCheckConn.Open()
Dim checkCmd1 As New SqlCommand(strcheckSQL, sqlCheckConn)
checkCmd1.Parameters.AddWithValue("@uID", userID)
checkCmd1.Parameters.AddWithValue("@fDate", inputDate)
CheckInsUpd = checkCmd1.ExecuteScalar
sqlCheckConn.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function
Any line wrapping is down to the browser...
I'm guessing this is a problem with my program structure as I'm
totally self taught so apologies if this is a noob error. I've scanned
the newsgroups but can't see anything applicable...
Paul
Any help greatly appreciated before I finish pulling the rest of my
hair out.
I'm making a program that allows a user to record their hours. There
are five rows (monday to friday). When a user clicks submit the
programme checks if the row has got user data. If it does it checks if
that day already has data held against it and then does an update or
insert accordingly.
It is all working apart from when the program comes to check the
second day it times out on the command. That command run in query
analyser works fine. The function that carries out the check is
Function CheckInsUpd(ByVal userID As Integer, ByVal inputDate As
String) As Integer
Try
Dim sqlCheckConn As New SqlConnection(strConn)
Dim strcheckSQL As String = "select count(detailID) from
flexiDetail where userID = @uID and flexiDate = @fDate"
sqlCheckConn.Open()
Dim checkCmd1 As New SqlCommand(strcheckSQL, sqlCheckConn)
checkCmd1.Parameters.AddWithValue("@uID", userID)
checkCmd1.Parameters.AddWithValue("@fDate", inputDate)
CheckInsUpd = checkCmd1.ExecuteScalar
sqlCheckConn.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function
Any line wrapping is down to the browser...
I'm guessing this is a problem with my program structure as I'm
totally self taught so apologies if this is a noob error. I've scanned
the newsgroups but can't see anything applicable...
Paul