Click here to Skip to main content
15,885,546 members
Home / Discussions / C#
   

C#

 
AnswerRe: Storage Card in csharp smart device Pin
Tunisien8619-Apr-10 5:12
Tunisien8619-Apr-10 5:12 
QuestionHow to create an empty tableAdapter or deliver a tableAdapter to extern function Pin
Robert König16-Apr-10 0:13
Robert König16-Apr-10 0:13 
AnswerRe: How to create an empty tableAdapter or deliver a tableAdapter to extern function Pin
Morgs Morgan16-Apr-10 10:06
Morgs Morgan16-Apr-10 10:06 
GeneralRe: How to create an empty tableAdapter or deliver a tableAdapter to extern function Pin
Robert König19-Apr-10 2:45
Robert König19-Apr-10 2:45 
Questionload dataGrid C# Pin
toto_201015-Apr-10 23:29
toto_201015-Apr-10 23:29 
AnswerRe: load dataGrid C# Pin
mrkeivan16-Apr-10 1:01
mrkeivan16-Apr-10 1:01 
QuestionRe: load dataGrid C# Pin
toto_201016-Apr-10 1:58
toto_201016-Apr-10 1:58 
AnswerRe: load dataGrid C# Pin
Morgs Morgan16-Apr-10 2:41
Morgs Morgan16-Apr-10 2:41 
Not quiet certain on the above 'principles' but try this:
try
{
     string query = @"SELECT * FROM [contacts]";
     conn.Close();//you must have created this connection string already
     SqlCommand cmd = conn.CreateCommand();//sql command
     cmd.CommandText = query;//declared above
     conn.Open();//open your connection to the database
     SqlDataReader reader = cmd.ExecuteReader();//execute reader to read from database
     DataSet dataset = new DataSet();//you need this
     DataTable table = dataset.Tables.Add();
     table.Columns.Add("contactid", typeof(string));//these
     table.Columns.Add("firstname", typeof(string));//must be column
     table.Columns.Add("lastname", typeof(string));//names in
     table.Columns.Add("email", typeof(string));//your datagrid
     while (reader.Read())
     {
         //add rows to your table which already has column names/heards...see above
         table.Rows.Add(reader["contact_id"].ToString(), reader["name"].ToString(), reader["surname"].ToString(), reader["email"].ToString());
     }
     //check if any data was added in a while(reader.Read())
     if (dataset.Tables[0].Rows.Count > 0 || dataset.Tables.Count > -1)
     {
         contacts.DataSource = table;//just like it says
         contacts.DataBind();
         contacts.Visible = true;
     }
 }
 catch (SqlException fc)
 {
     error.Text = "Error occured :" + fc.Message;//catch that error
 }
 finally
 {
     conn.Close();//please close connection to your database when done
 }
 //hope this helps!!!

Later
GeneralRe: load dataGrid C# Pin
toto_201016-Apr-10 4:20
toto_201016-Apr-10 4:20 
QuestionReguler expression [modified] Pin
bhaskarsgb15-Apr-10 23:23
bhaskarsgb15-Apr-10 23:23 
AnswerRe: Reguler expression Pin
riced16-Apr-10 1:33
riced16-Apr-10 1:33 
GeneralRe: Reguler expression Pin
bhaskarsgb16-Apr-10 1:54
bhaskarsgb16-Apr-10 1:54 
GeneralRe: Reguler expression Pin
Gideon Engelberth16-Apr-10 2:52
Gideon Engelberth16-Apr-10 2:52 
GeneralRe: Reguler expression Pin
JTS16-Apr-10 2:57
JTS16-Apr-10 2:57 
GeneralRe: Reguler expression Pin
OriginalGriff16-Apr-10 4:58
mveOriginalGriff16-Apr-10 4:58 
GeneralRe: Reguler expression Pin
bhaskarsgb16-Apr-10 7:17
bhaskarsgb16-Apr-10 7:17 
AnswerRe: Reguler expression Pin
Morgs Morgan16-Apr-10 2:57
Morgs Morgan16-Apr-10 2:57 
QuestionCreating videos from images Pin
TimSWatson15-Apr-10 23:15
TimSWatson15-Apr-10 23:15 
AnswerRe: Creating videos from images Pin
Luc Pattyn16-Apr-10 0:13
sitebuilderLuc Pattyn16-Apr-10 0:13 
AnswerRe: Creating videos from images Pin
annathor16-Apr-10 1:18
annathor16-Apr-10 1:18 
AnswerRe: Creating videos from images Pin
TimSWatson16-Apr-10 1:59
TimSWatson16-Apr-10 1:59 
GeneralRe: Creating videos from images Pin
ragnaroknrol16-Apr-10 3:02
ragnaroknrol16-Apr-10 3:02 
GeneralRe: Creating videos from images Pin
TimSWatson16-Apr-10 3:26
TimSWatson16-Apr-10 3:26 
GeneralRe: Creating videos from images Pin
ragnaroknrol16-Apr-10 4:41
ragnaroknrol16-Apr-10 4:41 
QuestionDevelop IE plugin in C# to show custom content Pin
Olivier Baillard15-Apr-10 22:08
Olivier Baillard15-Apr-10 22:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.