.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> VB.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Connecting to TOAD table using VB

Posted By: Ritwika     Posted Date: March 21, 2011    Points:5   Category :VB.Net
Hi,

The following is just a test code. I am trying to make changes in my TOAD table using visual basic., on the click of a button.

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Try
con.ConnectionString = "Data Source=TESTHR1;Persist Security Info=True;User ID=HELPDESK;Password=HELPDESK"
con.Open()
cmd.Connection = con
cmd.CommandText = "UPDATE table HEALTHSYSTEM_ARTICLES SET SUBJECT = 'Airway Management System'WHERE ID_NO=1411"
cmd.ExecuteNonQuery()

Finally
con.Close()
End Try

End Sub

I am getting this error:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Please tell me if theres any problem with this particular line,

con.ConnectionString = "Data Source=TESTHR1;Persist Security Info=True;User ID=HELPDESK;Password=HELPDESK"


Thanks,
Regards,
Ritwika Deb


Responses
Author: Sunil Yadav       [Moderator]      
Posted Date: March 21, 2011     Points: 20   

Hi,

Try resetting Persist Security Info=False or remove this tag.

Bydefault it is set to false.

Setting Persist Security Info=True in a connection string allows security sensitive informations like userid and password to be obtained from connection string even if the connection has een closed.

For more info http://msdn.microsoft.com/en-us/library/ff647552.aspx#pagguidelines0002_config3

Try below connectionstring.

con.ConnectionString = "Data Source=TESTHR1;Persist Security Info=True;User ID=HELPDESK;Password=HELPDESK"


Hope this helps.



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend