|
If you're using an Access database as part of your project, you application is modifying a copy of the database made in the bin folder of your project. WHen you come back to the project and run it again, the .MDB file in the bin folder is overwritten with the copy of the database as it was when you added it to the project.
|
|
|
|
|
ok,i solve it, hank you very much
|
|
|
|
|
Is there C# code that will take an image and a list of RGB values and make the image out of the RGB colors with floyd steinberg dithering?
|
|
|
|
|
afjepoifesahie wrote: there C# code that will take an image and a list of RGB values and make the image out of the RGB colors with floyd steinberg dithering?
Is there some problem Googling for "floyd steinberg dithering c#" for examples and libraries?
|
|
|
|
|
But that would be too easy. Clearly this person likes a challenge!
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
I'm needing a little help figuring out the best way to check if a table exist in an access DB and then set a flag to create the Table. I want to set this up with reusable code.
right now i am setting the commandtext with the SQL query that I want to convert to varaibles but want to figure out how I want to do this first because it is most likely part of the overall solution for this.
I'm opening the Database reading the GetSchema and reading each table name and have an array of my tables that the program is going to create, I can compare these but I'm getting lost on how to keep three array's in sync with out putting in individual checks for each table. yes the code below only has 5 tables but this application is going to grow in future versions and i don't want to have to go back and recode this or add checks for each table.
string[] NATables = new string[5];
NATables[0] = "Group Policy";
NATables[1] = "GPO Computer Settings";
NATables[2] = "GPO User Settings";
NATables[3] = "GPO Links";
NATables[4] = "GPO Delegation";
String connect = "Provider=Microsoft.JET.OLEDB.4.0;data source=.\\Test.mdb";
OleDbConnection con = new OleDbConnection(connect);
con.Open();
OleDbCommand cmd = con.CreateCommand();
DataTable dt = con.GetSchema("tables");
con.Close();
DataRow[] rows = dt.Select();
for (int i =0; i < rows.Length; i++ )
{
string r = rows[i]["TABLE_NAME"].ToString();
for (int j = 0; j < NATables.Length; j++)
{
if (r == NATables[j])
{
}
else
{
}
}
}
con.Open();
cmd.CommandText = "CREATE TABLE [Group Policy]([GPO GUID] Text(50) NOT NULL Unique PRIMARY KEY,[GPO NAME] TEXT(50) NOT NULL,[GPO Domain] TEXT(50) NOT NULL,Created datetime NOT NULL,Modified datetime NOT NULL,Status TEXT(10) NOT NULL)";
try
{
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
|
|
|
|
|
Not quite sure what the problem is but perhaps a little bit different approach could be useful to you:
- create a class that represents a table with properties such as table name, create statement, to be created bit (which defaults to true)
- create an instance for all of your tables
- place the created instances to a generic dictionary (
Dictionary<string,> ), place the table name to the key of the dictionary item - after this get the schema
- loop every row found from schema and set the corresponding item in the dictionary to not to create the table
- after this you can loop the dictionary and execute every create statement from the instances where create bit is still true
- the instances can be created based on for example a xml file if you want to add tables without modifying the code (in this case take good care for the seurity issues)
Hope this helps,
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
i used two arrays and rewrote my SQL execute to a function and used two for loops, i might convert the Arrays to XML or store in a config file down the road but for now I have this part 100% done have to move on to the main focus of the solution i am working on parsing a very nested XML file
Thanks for your suggestions
bool create = false;
for (int j = 0; j < NATables.Length; j++)
{
create = true;
for (int i = 0; i < rows.Length; i++)
{
string r = rows[i]["TABLE_NAME"].ToString();
if (r == NATables[j])
{
create = false;
return;
}
}
if (create == true)
{
string strQuery = CTquery[j];
RunSQLQuery(strQuery);
create = true;
}
}
|
|
|
|
|
You're welcome.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
i have three treeviews and they used the same database to but use difrent table to populate.
I have written the code i just dont know how i am going populate the Others.
Please help
This is my code that i have done
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Collections;
using System.Data.SqlClient;
namespace Envision
{
public partial class Envision : Form
{
SqlConnection conn = new SqlConnection("Data Source=ICNWS00054;Initial Catalog=EnvisionPlatformDatabase;User ID=sa;Password=3Password5");
SqlDataAdapter dtd;
DataSet ds;
DataView dv;
public TreeNode node;
public Envision()
{
InitializeComponent();
}
//
private void GetData(int EnCid, TreeNode EnNode)
{
dv = ds.Tables[0].DefaultView;
dv.RowFilter = "EnCid=" + EnCid;
int dvC = dv.Count;
if (EnNode == null)
{
int i = 0;
while (i &lt; dvC)
{
dv = ds.Tables[0].DefaultView;
dv.RowFilter = "EnCid=" + EnCid;
TreeNode node = new TreeNode();
node.Text = dv[i]["EnNode"].ToString();
node.Tag = int.Parse(dv[i]["NodeId"].ToString());
this.treeView1.Nodes.Add(node);
GetData((int)node.Tag, node);
i++;
}
}
else
{
int i = 0;
while (i &lt; dvC)
{
dv = ds.Tables[0].DefaultView;
dv.RowFilter = "EnCid=" + EnCid;
TreeNode node = new TreeNode();
node.Text = dv[i]["EnNode"].ToString();
node.Tag = int.Parse(dv[i]["NodeId"].ToString());
EnNode.Nodes.Add(node);
GetData(int.Parse(dv[i]["NodeId"].ToString()), node);
i++;
}
}
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
ArrayList EnvisionP = new ArrayList();
TreeNode EnNode = new TreeNode("EnNode");
EnNode.Tag = EnvisionP;
dtd = new SqlDataAdapter("select * from [User Panel] order by NodeId", conn);
ds = new DataSet();
dtd.Fill(ds, "User Panel");
GetData(0, null);
}
private void ultraExplorerBar1_ItemClick(object sender, Infragistics.Win.UltraWinExplorerBar.ItemEventArgs e)
{
}
private void treeView1_AfterSelect_1(object sender, TreeViewEventArgs e)
{
}
private void treeView2_AfterSelect(object sender, TreeViewEventArgs e)
{
}
private void ultraListView1_ItemActivated(object sender, Infragistics.Win.UltraWinListView.ItemActivatedEventArgs e)
{
}
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
|
|
|
|
|
Hello dear friend,
It's clear that you are new in CP. So read the first post of page1, titled "How to get an answer to your question" by "Chris Maunder", it will guide you how to post your questions. Take a look here[^] and here[^] for more info.
Have a nice journey here in CP
While (true) { Human.isLearnable = true; }
|
|
|
|
|
|
|
Thank You Very Much
|
|
|
|
|
Let's see... not too familiar with sarcasm, aren't we?
|
|
|
|
|
|
Hi Craig,
if you need urgent help d´ont post call 911 instead!!!
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Okay...
Personally I would create some sort of a class which contains the data I want to access.
public class MyDataTag
{
public MyDataTag(DataRowView dataRow)
{
itemID = dataRow["NodeId"];
text = dataRow["EnNode"].ToString();
otherInfo = dataRow["OtherInfo"].ToString();
}
public object itemID;
public string text;
public string otherInfo;
}
Then I would replace the tree node creation code with:
TreeNode node = new TreeNode();
MyDataTag dataTag = new MyDataTag(dv[i]);
node.Text = dataTag.text;
node.Tag = dataTag;
And your AfterSelect event handler:
MyDataNode itemData = e.Node.Tag as MyDataNode;
if (itemData != null)
{
string test = string.Format("ID: {0} Other Info: {1}", itemData.itemID.ToString(), itemData.otherInfo);
ListViewItem newItem = listView1.Items.Add(test);
newItem.Tag = itemData;
}
Lea Hayes
|
|
|
|
|
|
I have a Windows Form MDI which 3 treeviews that are separated by a Split Container.
I am trying to make them populate from the same Database but with diffrent tables for each treeview.
So far i have managed to only populate one out the three and could some help me please?
Thank you in advance
|
|
|
|
|
Just treat them as 3 treeviews, the fact they are in split containers should not be relevant. Just bind each one to the appropriate data source.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Im Sorry Im New to Programming so i dont know how to do it.
Could you please help me ?
|
|
|
|
|
After flooding the forum with no less then 4 near-identical posts, I dont think anyone is going to be in the mood to help you.
|
|
|
|
|
I second that.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
im very sorry for that.
I just wanted a little help
but thank you
|
|
|
|