| Author: Sandeep Chougule 30 Aug 2008 | Member Level: Gold | Rating: Points: 6 |
Hi check this All table name inserted into combo Same this u can add names in Array list
cmm = new SqlCommand(); cmm.Connection = con; cmm.CommandType = CommandType.Text; cmm.CommandText = " select name from sys.tables"; SqlDataAdapter da = new SqlDataAdapter(cmm); DataTable dt = new DataTable(); da.Fill(dt); DataView dv=new DataView(dt); cmbDatabase.DataSource = dv; cmbDatabase.DataTextField = "name"; cmbDatabase.DataBind(); con.Close();
|
| Author: Vidhya 30 Aug 2008 | Member Level: Gold | Rating: Points: 6 |
hi,
Here is an example:
PERSON: ==========
package adf.dc.test;
public class Person {
private String name; private String firstname; private String address; private String zip; private String city;
public Person() { }
public void setName(String name) { this.name = name; }
public String getName() { return name; }
public void setFirstname(String firstname) { this.firstname = firstname; }
public String getFirstname() { return firstname; }
public void setAddress(String address) { this.address = address; }
public String getAddress() { return address; }
public void setZip(String zip) { this.zip = zip; }
public String getZip() { return zip; }
public void setCity(String city) { this.city = city; }
public String getCity() { return city; } }
PERSONS MODEL ===============
package adf.dc.test;
import java.util.ArrayList; import java.util.List;
public class DCModelSrc {
private Person p; List<Person> al = new ArrayList<Person>();
public DCModelSrc() {
for (int i = 0; i < 10; i++) { p = new Person(); p.setName(i+"_Lastname"); p.setFirstname(i+"_Firstname"); p.setAddress(i+"_Address"); p.setZip(i+"_Zip"); al.add(p); } }
public List<Person> getModel(){ return al; }
}
CREATING THE DATACONTROL ========================
Select the "DCModelSrc" entry and choose "Create Datacontrol" from the context menu. Open a View project and drag the model entry as a table.
Happy programming!
|
| Author: Rajesh(March-2008 Winner) 30 Aug 2008 | Member Level: Gold | Rating: Points: 3 |
select * from sqlite_master where type = 'table'
Right. That will work for SQLite. Or you can just use the TableSchemas method of the Database class and the REAL SQL Database will do it for you.
|