Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

sharp source

@sharp source
About
Posts
10
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • query: Oledb database and a BindingList
    S sharp source

    Your 2 first suggestions i allready tried. And as you say, i need to limit the data getting. Btw, it's not 2000 but 20 000 :wtf: rows.... So restricting the logic of data getting. How would i do that? So i create a dataset Add two DataTables OledbDataAdapter.Fill(DataTable1); How do i get the BindingList TableId into a table? And after I have a dataset with the two tables... I gues i can figure that out. Thx

    C# database help question

  • query: Oledb database and a BindingList
    S sharp source

    goal: Display all records from a specified table in a Visual Foxpro database in a DGV. This would not be a problem, except, i only want those rows which have a record id contained by a BindingList TableId I've tried this: OledbConnection = new OleDbConnection(connectionString); OledbCommand = new OleDbCommand(query,connection); OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, connection); foreach(string id in TableId) { query = "SELECT * FROM " + tableName + " WHERE (" + tableRecordIDColumn + " = '" + id + "') ORDER BY " + tableRecordIDColumn; command.CommandText = query; dataAdapter.SelectCommand = command; dataAdapter.Fill(dataTableFromDb); } bindingSource1.DataSource = dataTableFromDb; dataGridView1.AutoGenerateColumns = true; dataGridView1.DataSource = bindingSource1; Allthough this works, it's extremely slow. Especially since my BindingList TableId could contain 20 000 record id's. Would there be any way to create a dataset with two tables on wich i could excecute a select query wich an inner join on the record id's?? And then use the results as the DataGridView.DataSource? grts, thx

    C# database help question

  • BindingList and DataGridView question. [modified]
    S sharp source

    wel, defining properties did the trick. Thanks a lot for your time, and patience ;)

    C# question database data-structures help

  • BindingList and DataGridView question. [modified]
    S sharp source

    that's already in there: public partial class FormAlgemeen : Form { BindingList listOfDoubleIndexTables = new BindingList(); Good point about my modifiers though, i'll rewrite and add some accessor methods later.

    C# question database data-structures help

  • BindingList and DataGridView question. [modified]
    S sharp source

    Ok, i'll start over. The goal of the application is to check visual foxpro tables of an application named omniwin for numerous different problems. The important one for this problem is the analysis of the index key's uniqueness. First the user selects the root of omniwin. After the root is validated this application checks the data tables for double index keys. All the tables wich have to be checked can be found in a table called tableinfo (tableinfo.dbf) and from that table i take the tablename, index field of table, and location of the file in which it is stored. These variables are stored in an instance of ActiveTable, named tableToAnalyze. Next the table is analysed by invoking tableToAnalyze.CheckForDoubleKey(). That method checks number of rows (tableToAnalyze.tableRecords) and number of distinct(id) rows (tableToAnalyze.tableUniqueRecords). If those values do not match the method stores the not distinct keys in a queue (tableToAnalyze.doubleKey) When the table is checked and tableToAnalyze.doubleKey.count() > 1 the instance tableToAnalyse is added to the BindingList listOfDoubleIndexTables. My intention is to display the BindingList listOfDoubleIndexTables in a DGV on the form. Then I can delete rows before starting a fix method because not all problems should be fixed. Problem: I've added a DGV on the form (desinger) and named it: dataGridDoubleKey I've set the DataSource of the DGV to the appropriate datasource: dataGridDoubleKey.datasource=listOfDoubleIndexTables; I've set the AutoGenerateColumns property to true. But the DGV does not create columns and ofcourse does not display any rows. So i thought, i'll define the rows myself. i set the the AutoGenerateColumns property to false and defined the colums as such: //dataGridDoubleKey.Columns.Add("omniwinRoot", "locatie"); //dataGridDoubleKey.Columns[0].Visible = false; //dataGridDoubleKey.Columns.Add("table", "Table"); //dataGridDoubleKey.Columns.Add("tableKey", "Key"); //dataGridDoubleKey.Columns.Add("tableRecords", "Table records"); //dataGridDoubleKey.Columns[3].Visible = false; //dataGridDoubleKey.Columns.Add("tableUniqueRecords", "Table Unique Records"); //dataGridDoubleKey.Columns[4].Visible = false; //dataGridDoubleKey.Columns.Add("diff", "Number of double keys"); //dataGridDoubleKey.Columns.Add("doubleKey", "Queue double keys"); //dataGridDoubleKey.Columns.Add("noNv

    C# question database data-structures help

  • List classList = new List();
    S sharp source

    Yes, that helped ;) thanks

    C# database css data-structures question

  • BindingList and DataGridView question. [modified]
    S sharp source

    Sorry, i only wanted the relevant parts of my code. I messed up and should have reread before posting. I made some corrections and added a few lines. Hope it will make more sense. If you want to, http://users.telenet.be/simonsmeets/source.zip[^] holds the project. thx 4 your time... simon

    C# question database data-structures help

  • BindingList and DataGridView question. [modified]
    S sharp source

    public class ActiveTable { public string omniwinRoot; public string table; public string tableKey; public int tableRecords; public int tableUniqueRecords; public int diff; public Queue doubleKey = new Queue(); public Queue noNversion = new Queue(); analyzeTable() { // if there is a problem with the index key (eg uniqueness) the id is put in the // doubleKey Queue. } } public class form1 { BindingList bindingList1 = new BindingList(); dataGridView1.DataSource = bindingList1; dataGridView1.AutoGenerateColumns = true; ActiveTable tableToCheck = new AvtiveTable(); // tableTocheck.omniwinRoot is assigned a value from a table // tableTocheck.table is assigned a value from a table // tableTocheck.tableKey is assigned a value from a table tableTocheck.analyseTable(); if (tableToCeck.doubleKey.Count() > 0) { bindingList1.Add(tableToCheck); } } My question is: why doesn't this work. The DataGridView has a datasource and should be able to generate columns, yes? Why doesn't my DataGridView create columns and adds rows when items are added to bindinglist? I've tried lots of different things. Such as defining the columns myself. With defined columns i see that there are rows added to the DataGridView but the columns remain empty. Any suggestions? -- modified at 13:35 Tuesday 29th May, 2007

    C# question database data-structures help

  • List classList = new List();
    S sharp source

    That did the trick indeed. I thought about it but couldn't understand why this would help. Still don't, hoping to come across an answer in the coming days. (studying c# for work) Anyway, thanks a lot.

    C# database css data-structures question

  • List classList = new List();
    S sharp source

    Hey guys, I'm trying to check the uniqueness of the index key of visual foxpro tables. From the tableinfo table I read all names of the tables in the database and the name of their index key. The name, index key and path (omniwinroot) are stored in an instance of class ActiveTable named tableToAnalyze Next I invoke a member method of ActiveTable (Analyze.Table) on that instance. This executes 2 queries on the table. The first one counts all the records, last one counts only those with distinct index key. If there are less unique index keys then there are rows in the table then the UNunique index keys are safed in a queue (so it could be fixed later). The goal is to copy (by value) tableToAnalyze to a list of instances of ActiveTable when double index keys were found. So something like this: Class classVar = new Class(); list classList= new List(); classVar.integer1 = 1; classVar.integer2 = 3; if (condition) classList.Add(classVar); From there i could display in a datagridview and prompt the user to repair (only those tables he wants to repair). The code I have seems to copy by reference. After all the tables are analyzed my list holds 2 (which is correct) of the same values. Both hold the values of the last table What am i doing wrong? private void dubbelNummeringToolStripMenuItem_Click(object sender, EventArgs e) { string sqlQueryTableInfo ="SELECT ctableid, flocation, ctablename, caliasname, cidfield, cidindex, cdatabase FROM tableinfo WHERE (cdatabase = 'dpatient') AND (flocation = 'data') AND (cidfield <> '') ORDER BY ctablename"; string connectionStringTableInfo = "Provider=VFPOLEDB.1;" + "Data Source=" + omniwinRoot + "\\tableinfo.dbf"; OleDbCommand commandTableInfo = new OleDbCommand(sqlQueryTableInfo); ActiveTable tableToAnalyze = new ActiveTable(); List tableToAnalyzeList = new List(); using (OleDbConnection ConnTableInfo = new OleDbConnection(connectionStringTableInfo)) { try { ConnTableInfo.Open(); commandTableInfo.Connection = ConnTableInfo; OleDbDataReader readerTableInfo = commandTableInfo.ExecuteReader(CommandBehavior.CloseConnection); while (readerTableInfo.Read()) { tableToAnalyze.omniwinRoot = omniwinRoot;

    C# database css data-structures question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups