Click here to Skip to main content
15,887,027 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionBulk insert using table value parameter hangs my application Pin
Malikdanish15-Apr-15 21:04
professionalMalikdanish15-Apr-15 21:04 
AnswerRe: Bulk insert using table value parameter hangs my application Pin
jkirkerx16-Apr-15 8:58
professionaljkirkerx16-Apr-15 8:58 
GeneralRe: Bulk insert using table value parameter hangs my application Pin
Malikdanish16-Apr-15 9:04
professionalMalikdanish16-Apr-15 9:04 
GeneralRe: Bulk insert using table value parameter hangs my application Pin
jkirkerx16-Apr-15 10:41
professionaljkirkerx16-Apr-15 10:41 
GeneralRe: Bulk insert using table value parameter hangs my application Pin
Malikdanish16-Apr-15 20:45
professionalMalikdanish16-Apr-15 20:45 
GeneralRe: Bulk insert using table value parameter hangs my application Pin
jkirkerx17-Apr-15 8:02
professionaljkirkerx17-Apr-15 8:02 
GeneralRe: Bulk insert using table value parameter hangs my application Pin
Malikdanish17-Apr-15 18:29
professionalMalikdanish17-Apr-15 18:29 
GeneralRe: Bulk insert using table value parameter hangs my application Pin
jkirkerx19-Apr-15 9:18
professionaljkirkerx19-Apr-15 9:18 
Go through it with a fine tooth comb and keep checking
Here's an error I overlooked, the checkbox is boolean true or false, so it wrote an bit to the parameter of 0 or 1
Or perhaps it's a dropdown list since you used selected value.
.Add("@DistrictId", SqlDbType.TinyInt).Value = CheckBoxList1.SelectedValue

That's a lot data to insert all at once. You know that data writes and updates take longer to perform on the SQL server, in terms of time. And then you called a stored procedure after that.

You have an error somewhere. finding the error is easier if your code is more organized.
Maybe instead of so many partial writes, you gather all your data first, and package it up in a class, structure or model, and then do 1 write to the database. You just pass the class or structure to the database function, and do the write. On multiple records, you just loop the database write function.

https://msdn.microsoft.com/en-us/library/aa289521%28v=vs.71%29.aspx[^]

http://www.functionx.com/visualbasic/Lesson19.htm[^]

In a seperate file
Public Structure structure_accountInfo
    Public m_firstName as string
    Public m_lastName as string
End Structure
In a seperate file
Public Shared Function account_db_update(ByVal sAI as structure_accountInfo) as Integer

    Dim dwExitCode As Integer = 2
    Dim connStr As String = ConfigurationManager.ConnectionStrings("DefaultConnection").ConnectionString
    Dim conn As New SqlConnection(connStr)

    Dim query as string = _
    "UPDATE TABLE " & _
    " SET " & _
    "  firstName = @firstName " & _
    ", lastName = @lastName " & _
    " WHERE ID = @ID "

    Dim cmd As New SqlCommand(query, conn)

    Dim param__FirstName As SqlParameter
    param__FirstName = New SqlParameter("@FirstName", SqlDbType.VarChar, 80)
    param__FirstName.Value = sAI.m_firstName
    cmd.Parameters.Add(param__FirstName)

    Dim param__LastName As SqlParameter
    param__LastName = New SqlParameter("@LastName", SqlDbType.VarChar, 80)
    param__LastName.Value = sAI.m_lastName
    cmd.Parameters.Add(param__LastName)

    Try
        conn.Open()
        cmd.ExecuteNonQuery();

        dwExitCode = 0

    Catch ex As Exception
        dwExitCode = 1

    Finally

        conn.Close()
        conn = Nothing
        cmd = Nothing

    End Try

    return dwExitCode

End Function

In a seperate file
Dim sAI as new structure_accountInfo()
sAI.m_firstName = txt_firstName.text.trim
sai,m_lastName = txt_lastName.Trim

account_db_update(sAI)

You have so much code in the first example, I can't help you isolate your error until you isolate it down to a more narrow focus.
Questionissue wih gridview Pin
Praveen Kandari15-Apr-15 0:20
Praveen Kandari15-Apr-15 0:20 
SuggestionRe: issue wih gridview Pin
ZurdoDev15-Apr-15 3:31
professionalZurdoDev15-Apr-15 3:31 
AnswerRe: issue wih gridview Pin
User 418025410-Jul-15 11:18
User 418025410-Jul-15 11:18 
GeneralRe: issue wih gridview Pin
Praveen Kandari15-Jul-15 19:17
Praveen Kandari15-Jul-15 19:17 
GeneralRe: issue wih gridview Pin
User 418025416-Jul-15 2:21
User 418025416-Jul-15 2:21 
QuestionHow to fix “Googlebot can't access your site” issue? Pin
Tridip Bhattacharjee14-Apr-15 21:16
professionalTridip Bhattacharjee14-Apr-15 21:16 
AnswerRe: How to fix “Googlebot can't access your site” issue? Pin
Richard Deeming15-Apr-15 1:38
mveRichard Deeming15-Apr-15 1:38 
AnswerRe: How to fix “Googlebot can't access your site” issue? Pin
ZurdoDev15-Apr-15 3:32
professionalZurdoDev15-Apr-15 3:32 
QuestionReading Excel File Pin
anokeha_prani14-Apr-15 20:34
anokeha_prani14-Apr-15 20:34 
SuggestionRe: Reading Excel File Pin
Richard MacCutchan14-Apr-15 21:13
mveRichard MacCutchan14-Apr-15 21:13 
GeneralRe: Reading Excel File Pin
anokeha_prani16-Apr-15 0:35
anokeha_prani16-Apr-15 0:35 
GeneralRe: Reading Excel File Pin
Richard MacCutchan16-Apr-15 1:00
mveRichard MacCutchan16-Apr-15 1:00 
QuestionPorting ASP / Accessdb app from one VM env to another Pin
6fingers14-Apr-15 4:49
6fingers14-Apr-15 4:49 
AnswerRe: Porting ASP / Accessdb app from one VM env to another Pin
jkirkerx14-Apr-15 7:31
professionaljkirkerx14-Apr-15 7:31 
GeneralRe: Porting ASP / Accessdb app from one VM env to another Pin
6fingers18-Apr-15 4:49
6fingers18-Apr-15 4:49 
GeneralRe: Porting ASP / Accessdb app from one VM env to another Pin
jkirkerx19-Apr-15 9:26
professionaljkirkerx19-Apr-15 9:26 
QuestionGridView Looping Pin
Member 1024160513-Apr-15 2:16
Member 1024160513-Apr-15 2:16 

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.