Click here to Skip to main content
15,123,118 members
Home / Discussions / C#
   

C#

 
AnswerRe: Storage Card in csharp smart device Pin
Tunisien8619-Apr-10 6:12
MemberTunisien8619-Apr-10 6:12 
QuestionHow to create an empty tableAdapter or deliver a tableAdapter to extern function Pin
Robert König16-Apr-10 1:13
MemberRobert König16-Apr-10 1:13 
AnswerRe: How to create an empty tableAdapter or deliver a tableAdapter to extern function Pin
Morgs Morgan16-Apr-10 11:06
MemberMorgs Morgan16-Apr-10 11:06 
GeneralRe: How to create an empty tableAdapter or deliver a tableAdapter to extern function Pin
Robert König19-Apr-10 3:45
MemberRobert König19-Apr-10 3:45 
Questionload dataGrid C# Pin
toto_201016-Apr-10 0:29
Membertoto_201016-Apr-10 0:29 
AnswerRe: load dataGrid C# Pin
mrkeivan16-Apr-10 2:01
Membermrkeivan16-Apr-10 2:01 
QuestionRe: load dataGrid C# Pin
toto_201016-Apr-10 2:58
Membertoto_201016-Apr-10 2:58 
AnswerRe: load dataGrid C# Pin
Morgs Morgan16-Apr-10 3:41
MemberMorgs Morgan16-Apr-10 3: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 5:20
Membertoto_201016-Apr-10 5:20 
QuestionReguler expression [modified] Pin
bhaskarsgb16-Apr-10 0:23
Memberbhaskarsgb16-Apr-10 0:23 
AnswerRe: Reguler expression Pin
riced16-Apr-10 2:33
Memberriced16-Apr-10 2:33 
GeneralRe: Reguler expression Pin
bhaskarsgb16-Apr-10 2:54
Memberbhaskarsgb16-Apr-10 2:54 
GeneralRe: Reguler expression Pin
Gideon Engelberth16-Apr-10 3:52
MemberGideon Engelberth16-Apr-10 3:52 
GeneralRe: Reguler expression Pin
JTS16-Apr-10 3:57
MemberJTS16-Apr-10 3:57 
GeneralRe: Reguler expression Pin
OriginalGriff16-Apr-10 5:58
mveOriginalGriff16-Apr-10 5:58 
GeneralRe: Reguler expression Pin
bhaskarsgb16-Apr-10 8:17
Memberbhaskarsgb16-Apr-10 8:17 
AnswerRe: Reguler expression Pin
Morgs Morgan16-Apr-10 3:57
MemberMorgs Morgan16-Apr-10 3:57 
QuestionCreating videos from images Pin
TimSWatson16-Apr-10 0:15
MemberTimSWatson16-Apr-10 0:15 
AnswerRe: Creating videos from images Pin
Luc Pattyn16-Apr-10 1:13
sitebuilderLuc Pattyn16-Apr-10 1:13 
AnswerRe: Creating videos from images Pin
annathor16-Apr-10 2:18
Memberannathor16-Apr-10 2:18 
AnswerRe: Creating videos from images Pin
TimSWatson16-Apr-10 2:59
MemberTimSWatson16-Apr-10 2:59 
GeneralRe: Creating videos from images Pin
ragnaroknrol16-Apr-10 4:02
Memberragnaroknrol16-Apr-10 4:02 
GeneralRe: Creating videos from images Pin
TimSWatson16-Apr-10 4:26
MemberTimSWatson16-Apr-10 4:26 
GeneralRe: Creating videos from images Pin
ragnaroknrol16-Apr-10 5:41
Memberragnaroknrol16-Apr-10 5:41 
QuestionDevelop IE plugin in C# to show custom content Pin
Olivier Baillard15-Apr-10 23:08
MemberOlivier Baillard15-Apr-10 23: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.