I want to try a simple program with java for my Nokia cell phone. Is there anybody to help me?
Sourie
I want to try a simple program with java for my Nokia cell phone. Is there anybody to help me?
Sourie
oh thanks I found 6 articles. I am going to read them.
Sourie
Hi all, Do you know a simple way to print contents of a DataGridView in a C# program?
Sourie
Finally I found it: DataGridView1.Columns[6].DefaultCellStyle.Format = "hh:mm:ss tt"; Thanks alot
Sourie
Hi Hem, I used this syntax: DataGridView1.Columns[6].DefaultCellStyle.Format = "hh:mm:ss"; but its output is the same for both "08:35:00 AM" and "08:35:00 PM" what is your suggestion?
Sourie
I have a field in a table in a database (MS Access). I have defined datatype : Date/Time with format: Short Time. But when I view my table in a gatagridview, I see for example 12/09/2005 12:35 AM help me please
Sourie
Thanks for your suggestion :)
Sourie
I am sorry it was like the previous problem. Because in the second table of my database, I defined a field named: "No". It was also a keyword for MS ACCESS. Thank you so much for helping me. Kiss your child
Sourie
I got another problem. I created similar table in my database and I named it as tbl2. I tryed the code for this table, but it is not working.
Sourie
Oh my God, It is working now. Thanks alot Mika, You are right "Date is a keyword for MS Access, I changed it to DateVal, and my code finally worked. :) Tnx alot
Sourie
This is my code: I reach an error: Syntax error in INSERT INTO statement. I know this error is because of line : dr["Date"] = Convert.ToDateTime(DateTime.Now.ToShortDateString()); But I donno how to solve it. I have a field named "Date", with datatype "DateTime", and with format "ShortDate". OleDbDataAdapter adp = new OleDbDataAdapter(); OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.JET.OLEDB.4.0;" + @"data source=f:\Wire1\WireDb.mdb"); conn.Close(); OleDbCommand cmd = new OleDbCommand("SELECT * FROM tbl1 ORDER BY Code", conn); adp.SelectCommand = cmd; OleDbCommandBuilder cb = new OleDbCommandBuilder(adp); DataSet ds = new DataSet("tbl1"); DataTable dt = new DataTable(); conn.Open(); adp.Fill(ds, "tbl1"); dt = ds.Tables[0]; DataRow dr = ds.Tables[0].NewRow(); int x = dt.Rows.Count; dr["Code"] = ++x; dr["Street"] = "Molavi"; dr["Alley"] = "Molavi 34"; dr["Status"] = true; dr["Date"] = Convert.ToDateTime(DateTime.Now.ToShortDateString()); ds.Tables[0].Rows.Add(dr); adp.Update(dt); ds.Clear(); adp.Fill(ds.Tables[0]); conn.Close();
Sourie
Like his: //dr indicates to a row of a table in Access Database. DataRow dr = new DataRow(); // I have defined two fields of type Date/Time in a table and now I want to give them value for the current row in the table: dr["Time"] = Convert.ToDateTime(DateTime.Now.ToShortTimeString()); dr["Date"] = Convert.ToDateTime(DateTime.Now.ToShortDateString()); Is it correct?
Sourie
thanks for your reply. I need to have to seperate fields : Date and Time, but when I want to define columns in Access, I only see a field : Date/Time. I do not know how to write from/read into this field in a c# program. (I want to read time and date from two different textBoxs and save them in related field in a Access table. and also I want to read Date and Time field from access and show them in a MessageBox.)
Sourie
How can I work with Date/Time field of Access Database in C#? I need to read these feilds of a row and show it in messagebox. Also I need to add new rows to a table in access and fill these fields for it.
Sourie
Hello again, according the lessons you gave me, I wrote a program that shows content of a table in a datagridview. Now I want to sort the content of the table based a field(ASC or DEC) and show the result in that datagridview. Database name= WirdDb, tablename= tbl2, fields: No, Code, Street, Alley, Status, Date and Time. I want to sort the content of tbl2 according field "Street" ascendingly. Would you please help me. OleDbDataAdapter adapter2 = new OleDbDataAdapter(); OleDbCommand command2 = new OleDbCommand("SELECT * from tbl2"+tbl2.Street, conn); adapter2.SelectCommand = command2; OleDbCommandBuilder cb2 = new OleDbCommandBuilder(adapter2); DataSet ds2 = new DataSet(); adapter2.Fill(ds2, "tbl2"); DataTable dt2 = ds2.Tables[0]; DataGridView dgv2 = new DataGridView(); dgv2.DataSource = dt2; this.Controls.Add(dgv2);
Sourie
Bravo! It worked also. thanks alotttttttttttttt. I won't forget your kind. may I get your help regard working with ports (Serial and USB) in c#?
Sourie
Wow, Finally I wrote a program :). Now I know what's the exact meaning of adapter, connection, dataset, datatable, and command. I will try your suggestion to use datagridview also.
Sourie
Oh thanks alot it is a good start for me.I have to read it and test ur program myself. But another question, How I can use a datagridview to show a table's content without puting datagridview object on the form? I want to define datagridview in my code.
Sourie
con1.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\WireDb.mdb"; con1.Open(); Int32 x1 = System.Convert.ToInt32(textBox1.Text);//Code String x2 = textBox2.Text;//Street String x3 = textBox3.Text;//Alley DateTime x4 = System.Convert.ToDateTime(textBox4.Text);//Date DateTime x5 = System.Convert.ToDateTime(textBox5.Text);//Time cmd1.CommandText = "INSERT INTO WIRETBL(Code, Street, Alley, Date, Time) VALUES(@Code, @Street, @Alley, @Date, @Time)"; cmd1.Parameters.AddWithValue("@Code", OleDbType.Integer).Value = x1; cmd1.Parameters.AddWithValue("@Street", OleDbType.VarChar).Value = x2; cmd1.Parameters.AddWithValue("@Alley", OleDbType.VarChar).Value = x3; cmd1.Parameters.AddWithValue("@Date", OleDbType.DBDate).Value = x4; cmd1.Parameters.AddWithValue("@Time", OleDbType.DBTime).Value = x5; //cmd1.ExecuteNonQuery(); cmd1.CommandType = CommandType.Text; cmd1.Connection = con1; cmd1.ExecuteNonQuery(); adp1.SelectCommand = cmd1; DataTable tb1 = new DataTable(); adp1.Fill(tb1); dataGridView1.DataSource = tb1; con1.Close(); Dear Friend how can I learn working with Access Database in c#? I need a complete reference to not bother you alot.
Sourie