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

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

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
con.ConnectionString = "Data Source=TESTHR1;Persist Security Info=True;User ID=HELPDESK;Password=HELPDESK"
cmd.Connection = con
cmd.CommandText = "UPDATE table HEALTHSYSTEM_ARTICLES SET SUBJECT = 'Airway Management System'WHERE ID_NO=1411"

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"

Ritwika Deb

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


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

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