Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 13th Apr 2011, 09:30 PM   #1
Warrior Member
 
Join Date: 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default
using asp.net ?
Share on: 
fb share twitter share gplus share more share

how to connect sql database to asp.net ? what is the code for that ?
iamroberts is offline  
Unread 14th Apr 2011, 03:03 AM   #2
New Warrior Member
War Room Member
 
Join Date: 2007
Location: Norderstedt (near Hamburg), Germany
Posts: 6
Thanks: 1
Thanked 2 Times in 2 Posts
Default
Re: using asp.net ?
Share on: 
fb share twitter share gplus share more share

just add the DB to the project in VS or in WebMatrix

otherwise you can find the connectionstring here :
ConnectionStrings.com - Forgot that connection string? Get it here!
jaythedane is offline  
Unread 14th Apr 2011, 01:26 PM   #3
John Wilson
War Room Member
 
Join Date: 2010
Location: Cheshire
Posts: 79
Thanks: 14
Thanked 24 Times in 7 Posts
Blog Entries: 1
Default
Re: using asp.net ?
Share on: 
fb share twitter share gplus share more share

just add the connection string.. if your using a sql server database you need to include the security params within the string if your using sql server ce (compact edition) you can link directly to the file.. use server.mappath to get the dynamic web path..

Get your back links indexed in 2 mins
http://www.imslave.com/LinkBlaster/
smadso is offline  
Unread 14th Apr 2011, 05:10 PM   #4
Active Warrior
 
Join Date: 2010
Location: Malaysia
Posts: 36
Thanks: 14
Thanked 0 Times in 0 Posts
Default
Re: using asp.net ?
Share on: 
fb share twitter share gplus share more share

string connetionString = null;
SqlConnection cnn ;
connetionString = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=UserName;Password=Password"
cnn = new SqlConnection(connetionString);
try
{
cnn.Open();
MessageBox.Show ("Connection Open ! ");
cnn.Close();
}
catch (Exception ex)
{
MessageBox.Show("Can not open connection ! ");
}

you make use of visual studio it will be more easy for u.
lloydblinks is offline  
Closed Thread


Bookmarks

Tags
aspnet


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 09:57 AM.