Dislay Data on datagrid

Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Jx_Man Jx_Man is offline Offline Apr 11th, 2008, 5:38 pm |
0
Just post simple code. Give a feedback if it helps u
Quick reply to this message  
C# Syntax
  1. using System;
  2. using System.Collection.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Data.SqlClient;
  9.  
  10. namespace WindowsApplication1
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18.  
  19. private void cmdtam_Klik(object sender, EventArgs e)
  20. {
  21. string cstr;
  22. cstr = "data source=jery;initial catalog=latihan;uid=sa;pwd=sri";
  23. SqlConnection con1 = new SqlConnection(cstr);
  24. con1.Open();
  25. SqlCommand com1 = new SqlCommand();
  26. com1.Connection = con1;
  27. com1.CommandType = CommandType.Text;
  28. com1.CommandText = "select * from customer"
  29. DataSet ds1 = new DataSet();
  30. SqlDataAdapter adp1 = new SqlDataAdapter(com1);
  31. adp1.Fill(ds1,"customer");
  32. grd1.DataMember = "customer";
  33. con1.Close();
  34. }
  35. }
  36. }
0
majestic0110 majestic0110 is offline Offline | May 12th, 2008
Nice snippet
 
0
Jx_Man Jx_Man is offline Offline | Jun 3rd, 2008
thx majestic0110
 
0
kalekau kalekau is offline Offline | Jul 14th, 2008
Pl Help me for query related to update date in SQL Server2005
in C#.NET
 
0
oscprofessional oscprofessional is offline Offline | Aug 18th, 2008
hey...buddie,
did u help me ,i want to connect remote database(mysql) with c#.......
and update database using datagrid in c#
 
 

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC