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

ASP.NET

 
AnswerRe: How to write to fileOutputStream mapped to physical file c# Pin
Tridip Bhattacharjee18-Apr-15 7:48
professionalTridip Bhattacharjee18-Apr-15 7:48 
AnswerRe: How to write to fileOutputStream mapped to physical file c# Pin
jkirkerx19-Apr-15 12:09
professionaljkirkerx19-Apr-15 12:09 
QuestionMake image appear after div, and next dive appear after image Pin
indian14316-Apr-15 9:29
indian14316-Apr-15 9:29 
AnswerRe: Make image appear after div, and next dive appear after image Pin
jkirkerx16-Apr-15 13:24
professionaljkirkerx16-Apr-15 13:24 
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 
How do you know this works?
cnnContact.Open()
trnContact = cnnContact.BeginTransaction()

cmdContact.Transaction = trnContact
cmdContact.ExecuteNonQuery()

Usually you try to keep your SQL more compact in a separate clean function.
Consider a simple request for an ID
This example opens the connection, reads the reader, closes the reader,
With the Try Catch Finally, if the connection or command fails, then the finally will close the connection.
Dim connStr As string = ConfigurationManager.ConnectionStrings("DefaultConnection").ConnectionString
Dim query as string = "SELECT ID FROM TABLE"

Dim conn as New SqlConnection(query)
Dim cmd as New SqlCommand(query, conn)

Try

    conn.open()
    Dim reader as SQLDataReader = cmd.ExecuteReader()
    while reader.Read()
      pValue = reader.GetInt32(0)
    End While

    reader.Close()

Catch ex as SQLException
    'If there is an error, this will tell you why, so fix the error
    ' but without the finally, the conn will be left open, 
    'So if you get too many conn open to the sql server, the sql server will hang

Finally
    conn.Close()

End Try


modified 17-Apr-15 13:55pm.

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 
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 

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.