help rqd with serverversion ... executeNonquery
-
hello.. i am developing an application in asp.net using c# and am getting an error in the command.executenonquery method which throws an exception that the executenonquery requires an open and active connection though just above the call to executenonquery method i have opened the connection as connection.open where connection is a property that gets the connection which has been made from configurationmanager.connectionstring... I know there is no problem with connectionstring coz i have tried executereader and it works fine... To my knowledge the error has something to do vith serverversion... coz when i run the executereader and check the connection object over there, the connection state is open but when i run the nonquery then the connection object shows in its serverversion the follwing string "ServerVersion = 'command.Connection.ServerVersion' threw an exception of type 'System.InvalidOperationException'" Plz note that state of connection is closed even after i call the connection.open method... Plz provide help
haseeb
-
hello.. i am developing an application in asp.net using c# and am getting an error in the command.executenonquery method which throws an exception that the executenonquery requires an open and active connection though just above the call to executenonquery method i have opened the connection as connection.open where connection is a property that gets the connection which has been made from configurationmanager.connectionstring... I know there is no problem with connectionstring coz i have tried executereader and it works fine... To my knowledge the error has something to do vith serverversion... coz when i run the executereader and check the connection object over there, the connection state is open but when i run the nonquery then the connection object shows in its serverversion the follwing string "ServerVersion = 'command.Connection.ServerVersion' threw an exception of type 'System.InvalidOperationException'" Plz note that state of connection is closed even after i call the connection.open method... Plz provide help
haseeb
Well, it's obvious that your code is broken, or your database server is broken. Seeing your actual code would go a long way to helping us comment on it.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Well, it's obvious that your code is broken, or your database server is broken. Seeing your actual code would go a long way to helping us comment on it.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
oh hello i am trying to insert a record to a table... the executenonquery gives the error that an open connection is rqd... when i replace the same comand with a selectcommand and the method to executereader it works but when its with executenonquery, it doesnt work
haseeb
-
Well, it's obvious that your code is broken, or your database server is broken. Seeing your actual code would go a long way to helping us comment on it.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
hello mr. Graus I have pasted the code... I am sorry ... Actually i didnt follow u by writin in the other message.. I thought that was a reply to my message and wrote there... Then i realized and pasted the same text in my message area... Also i wasn't online from my pc at that moment and couldnt send in the code... now i got a chance and pasted my code.... Best regards haseeb
haseeb