Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Hi all
 
while insertion when the control is comming to cmd.executenonquery() statement the application use to hang and exit..
please tell me why it is happening..i am using vb.net 2008 and sql 2005
Posted 20-Sep-12 21:53pm
Comments
Mehdi Gholam at 21-Sep-12 3:09am
   
You really have to supply more information since we cannot see your environment or code you are using.
snehasish nandy at 21-Sep-12 3:13am
   
Please tell me what more u want..
Ganesh Nikam at 21-Sep-12 4:41am
   
your code please
Ervin Pacibe at 23-Sep-12 23:50pm
   
your sql query pls
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
the issue is not know so use Try catch block so that in the exception we might come to know the exception which has been unhandeled. the reson might be the sql statement might be an error.
 
Execute the sql query in the sql or the database your using and check weather the statement is executing fine.
 
SQL connection might be the problem.
 
Happy coding...
  Permalink  
Comments
snehasish nandy at 21-Sep-12 3:43am
   
please tell me how to write the try catch block..
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Yes here we go,
 
  
        Try
            dim command as string= "Insert into table ("Name") values ("Beem")"
            MyConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("DBO").ConnectionString)
            MyConnection.Open()
            Dim MyCommand As SqlCommand
            MyCommand = New SqlCommand(command, MyConnection)
            MyCommand.ExecuteNonQuery()
            DisposeConnection()
        Catch ex As Exception
 
        End Try
 
this is how it will look like try this....
 
Good luck...
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 390
1 OriginalGriff 205
2 Zoltán Zörgő 124
3 Dave Kreskowiak 120
4 BillWoodruff 110
0 OriginalGriff 7,610
1 DamithSL 5,559
2 Sergey Alexandrovich Kryukov 5,324
3 Maciej Los 4,961
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100