Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C# Programming

Vote on your favorite hash algorithm here!

C# Programming C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old 06-30-2008, 03:19 PM
Siten0308 Siten0308 is offline
Learning Programmer
 
Join Date: Jun 2008
Posts: 90
Credits: 98
Rep Power: 2
Siten0308 is on a distinguished road
Talking Re: linking SQL database with C# problem

Hello,

I am finally back, i got a huge problem after installing vista SP1, dont install it, worst mistake ever, after installing it my computer crashed beyond recover, so after i reinstalled vista, installed C# sdk with sql 2005 express, now everything works, i am able to import all database and everything, the problem i am guessing is when i installed C# sdk, i did not install SQL with it, probably a tool to help link between the two, and later installed SQL 2005 standard edition without that link they dont know each other, no matter how much you try and point to each other, without installing SQL with C# package, it wont work, so let it be known, when installed C#, include everything!! i am fixed now thanks for everyones input and help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 07-01-2008, 11:22 AM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 7,553
Last Blog:
Web slideshow in JavaS...
Credits: 1,358
Rep Power: 61
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: linking SQL database with C# problem

Yay!
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."
Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 07-02-2008, 02:27 PM
Pancrazio Pancrazio is offline
Newbie
 
Join Date: Jun 2008
Posts: 17
Credits: 0
Rep Power: 2
Pancrazio is on a distinguished road
Default Re: linking SQL database with C# problem

Are you sure it wasn't just a bad connectionstring? I advice you to (learn how to) add new connections manually. It's not difficult. It's might be a bit more difficult to add data to webcontrols (if that's what you're doing), but once you understand the code and wrote it once you can just edit it for future uses. There are good tutorials for this online.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 07-02-2008, 02:38 PM
Siten0308 Siten0308 is offline
Learning Programmer
 
Join Date: Jun 2008
Posts: 90
Credits: 98
Rep Power: 2
Siten0308 is on a distinguished road
Default Re: linking SQL database with C# problem

can you give me an example pancrazio for future reference? maybe i will disconnect my database to my program to try it out.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 07-02-2008, 05:50 PM
Pancrazio Pancrazio is offline
Newbie
 
Join Date: Jun 2008
Posts: 17
Credits: 0
Rep Power: 2
Pancrazio is on a distinguished road
Default Re: linking SQL database with C# problem

I'm not an expert and it's been more than a year since I've used C# (needed it for school) but if I remember correctly it goes something like this using SQL server:

using System.Data.SqlClient; //Namespace

SqlConnection conn = new SqlConnection(
"server=myservername;database=mydatabasename;uid=m yusername;pwd=mypassword"); /* defining a SQL connection named 'conn' with the correct servername, databasename, userid and password. The thing between brackets is the connection string, there is a whole website somewhere about nothing but the connectionstring. */
conn.Open(); // open the connection
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select x from x where x";//Using your SQL command
cmd.Connection = conn;
string Result = (string)cmd.ExecuteScalar(); //Put the result in a string named Result
Console.Writeline(Result); //Writes it in the console
conn.Close(); // close the connection


For multiple results you can use SqlDataReader.

The framework database programming classes are referred to as ADO.NET . Look ok the internet for ADO.NET tutorials. Programming is all about managing and manipulating data, so if it's your ambition to develop professional web applications using C# and .NET for, you need to learn this stuff.

If you don't know how to use SQL commands, you should learn that too.
SQL Tutorial - Learn SQL is the website I learned it from.

Last edited by Pancrazio; 07-02-2008 at 06:42 PM. Reason: mistake
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



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

Advanced Search
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
C# with SQL database Siten0308 C# Programming 6 06-24-2008 09:33 AM
Tutorial: Advanced SQL Jordan Tutorials 2 04-07-2008 03:18 PM
Linking a Form to a SQL Database newguy15 Database & Database Programming 2 12-04-2007 02:13 AM
Best program for SQL database manipulation Rhadamanthys Database & Database Programming 3 07-02-2007 02:32 PM
Database Tuning Advisor in SQL Server 2005 reachpradeep Database & Database Programming 0 03-03-2007 12:46 PM


All times are GMT -5. The time now is 10:39 PM.

Contest Stats

Xav ........ 1357.94
MeTh0Dz|Reb0rn ........ 1077.71
WingedPanther ........ 919.18
marwex89 ........ 906.86
morefood2001 ........ 900.18
John ........ 890.77
Brandon W ........ 770.65
chili5 ........ 312.39
Steve.L ........ 264.99
dcs ........ 232.34

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 83%

Ads