User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 391,617 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,720 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 8051 | Replies: 3 | Solved
Reply
Join Date: Apr 2006
Posts: 1
Reputation: kbal024 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
kbal024 kbal024 is offline Offline
Newbie Poster

connecting sql to VB.NET

  #1  
Apr 9th, 2006
Hi
I am new to SQL and I am trying to connect to mssql server via vb.net with a code someone else has done. I am not sure why it won't connect. part of the code is below:

_DBConnection = New SqlConnection '(ConnectionString)
_DBConnection.ConnectionString = "Server=MASTEC;Database=CHH_Cardboard_DA_new;User ID=sa;Password=xxxx;Trusted_Connection=False"
_DBConnection.Open()


when I run this I get the following error:

"A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll

Additional information: System error."


I am able to connect using odbcconnection but the rest of the code uses commands from System.Data.SqlClient.

Can anyone help me please. :-|

Thank you
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Posts: 1
Reputation: webchetan is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
webchetan webchetan is offline Offline
Newbie Poster

Re: connecting sql to VB.NET

  #2  
May 5th, 2006
Please cut/copy/paste your code.. so that I can say what exactly is going wrong.

Thanks
Reply With Quote  
Join Date: May 2007
Posts: 1
Reputation: kay kay is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
kay kay kay kay is offline Offline
Newbie Poster

Re: connecting sql to VB.NET

  #3  
May 10th, 2007
Originally Posted by webchetan View Post
Please cut/copy/paste your code.. so that I can say what exactly is going wrong.

Thanks


Dim strDBConn As String = ""
Try
strDBConn = "Data Source=ccmsserver;Initial Catalog=db1;User ID=kamilia;Password=501011;"
Catch ex As Exception
End Try
Return strDBConn
Reply With Quote  
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation: jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough 
Rep Power: 30
Solved Threads: 264
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Microsoft Fanboy

Re: connecting sql to VB.NET

  #4  
May 10th, 2007
try adding the database as a connecttion in the Server Explorer window
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MS SQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 12:29 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC