Click here to Skip to main content
12,997,531 members (59,973 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 2008 and sql 2005
Posted 20-Sep-12 20:53pm
Mehdi Gholam 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 21-Sep-12 3:13am
Please tell me what more u want..
Ganesh Nikam 21-Sep-12 4:41am
your code please
Ervin Pacibe 23-Sep-12 23:50pm
your sql query pls
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

Solution 2


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...
snehasish nandy 21-Sep-12 3:43am
please tell me how to write the try catch block..
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Yes here we go,

            dim command as string= "Insert into table ("Name") values ("Beem")"
            MyConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("DBO").ConnectionString)
            Dim MyCommand As SqlCommand
            MyCommand = New SqlCommand(command, MyConnection)
        Catch ex As Exception
        End Try

this is how it will look like try this....

Good luck...

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2017
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