|
Does anyone of you know how to create a makefile using c#?
The makefile should be in what format e.g txt?
Where should the makefile be stored? In the same directory as my c# file remoteassembly.cs where I wish to use the makefile to create an assembly
Lastly, how do I use nmake to execute the makefile?
Thanks for your help. I posted this request only because the book that I am using does not show the way and I am also confused with the explantion provided in the documentation.
|
|
|
|
|
This article[^] discusses using C# with nmake and includes a sample makefile. Hopefully it may be of some use to you.
Also take a look at the samples in the Framework SDK
\Program Files\Microsoft.NET\FrameworkSDK\Samples\quickstart
All these have makefiles.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
I am trying to populate a grid based on 7 table join. For this I wrote an SQL Query in front end and then I am filling the tables in a Data Set. Everything works fine. But, I have to display two more columns ( Token# and License#) in the data grid based on the same table column (for ex; Ast_Refnr) which I am able to achieve too. I have a Product ID column in table and based on the Product ID value I need to fill the values in the addition columns.
The additional columns that I am displaying or Token# and License#.
If Product ID is 1, then I need to display a value for the column Token# in data grid and License# must be blank. Also, if the Product ID is 4, then I need to display a value in column License# and Token# must be blank.
Since I am populating the above two columns in data grid based on the same table column AST_Refnr value, neither Token# is empty nor License#. I dont know how to use conditions while popualting the Data Grid. Below I am copying a bit of my code which I use for populating data grid.
sSQL = "SELECT A.PRD_PRODUCTTYPE, C.AST_REFNR+' - '+ convert(varchar,D.SHP_SHIPDATE,101) Token#, " +
"C.AST_REFNR+' - '+ convert(varchar,D.SHP_SHIPDATE,101) License#, B.PRDD_ProductID, " +
"E.ASTP_TEMPLATENAME, F.ASTS_STATUS_DESCRIPTION, C.AST_REFNR, D.SHP_SHIPDATE FROM " +
"PRODUCT A,PRODUCTDETAIL B,ASSET C,SHIPPING D,ASSETPRODUCTS E,ASSETSTATUS F, Contact G WHERE " +
"A.PRD_PRODUCTID = B.PRDD_PRODUCTID AND B.PRDD_PRODUCT_ORDERID=C.AST_PRODUCT_ORDERID AND " +
"C.AST_ASSETID=D.SHP_ASSETID AND C.AST_DEFID=E.ASTP_DEFID AND C.AST_STATUSID=F.ASTS_STATUSID " +
"AND AST_ICA = '" + SearchForm.strPrimary + "' AND G.CNT_ContactID = D.SHP_contactID " +
"AND A.PRD_DELETED=0 AND B.PRDD_DELETED=0 AND C.AST_DELETED=0 AND D.SHP_DELETED=0 AND " +
"E.ASTP_DELETED =0 AND F.ASTS_DELETED=0 AND G.CNT_Deleted = 0 ORDER BY A.PRD_PRODUCTTYPE";
OdbcDataAdapter da = new OdbcDataAdapter(sSQL, con);
da.Fill(ds, "Product");
da.Fill(ds, "AssetProducts");
dataGrid1.DataSource = ds.Tables[0].DefaultView;
DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.RowHeadersVisible = false;
DataGridTextBoxColumn column1 = new DataGridTextBoxColumn();
column1.MappingName = "PRD_PRODUCTTYPE";
column1.HeaderText = "Product";
column1.Width = 70;
tableStyle.GridColumnStyles.Add(column1);
this.dataGrid1.TableStyles.Add(tableStyle);
tableStyle.MappingName = "Product";
--- This value I need to display in data grid if PRD_ProductID is 1
DataGridTextBoxColumn column6 = new DataGridTextBoxColumn();
column6.MappingName = "Token#";
column6.HeaderText = "Token#/ShippedDate";
column6.Width = 150;
tableStyle.GridColumnStyles.Add(column6);
this.dataGrid1.TableStyles.Add(tableStyle);
--- This value I need to display in data grid if PRD_ProductID is 4
DataGridTextBoxColumn column7 = new DataGridTextBoxColumn();
column7.MappingName = "Lic#";
column7.HeaderText = "License#/ShippedDate";
column7.Width = 150;
tableStyle.GridColumnStyles.Add(column7);
this.dataGrid1.TableStyles.Add(tableStyle);
This forum has helped me a great deal and again I am approaching this for help. Thanks everyone in advance.
Looney
|
|
|
|
|
Hope this helps,
Subscribe to DataTable.RowChanged event. In the event handler, check for the
DataRowAction.Add.
Then depending on the values of Product ID , set the values of Token# and License#.
Then call DataTable.AcceptChanges()
Here is some code snippet, please change accordingly
Private myTable As DataTable
Private Sub [AddHandler]()
myTable = CType(datagrid1.DataSource, DataTable)
AddHandler myTable.RowChanged, AddressOf Me.myDataTable_Changed
End Sub
Private Sub myDataTable_Changed _
(ByVal sender As System.Object, ByVal e As System.Data.DataRowChangeEventArgs)
Console.WriteLine("Row Changed", e.Action, _
e.Row.Item(datagrid1.CurrentCell.ColumnNumber))
End Sub
Live Life King Size
Alomgir Miah
|
|
|
|
|
This will be a lame question to those who know classes well, so go easy on me. I understand how to make simple classes, like one that can hold peoples' names and addresses). But I need to make one that can hold an array with an array. Here's my goal: I'd like to populate a class (array?) of server names, but I get confused when I try to have THAT class have an array of its own to hold all the services for each server. I hope that makes sense. Using 2D arrays is the easy method, I know, but I have to grasp classes at some point. Thank you for any help.
-Michael
|
|
|
|
|
An array is just a data structure, not a class on its own
An ArrayList, on the other hand, is a class - it has both data and behavior (methods) related to that data.
For what you want to do, an ArrayList (or perhaps even better a HashTable) would be a good choice. An arraylist instance contains a list of objects ( your servers, which could be your list of services, perhaps complex objects themselves, or just simple string service names).
public class Servers
{
private HashTable ServerList = new HashTable();
public Servers(){};
public void Add(string Servername, Server s)
{
ServerList.Add(serverName, s);
}
public Server GetServer( string serverName)
{
return (Server)Serverlist[Servername];
}
}
public class Server
{
private HashTable ServicesList = new HashTable();
private string serverName = string.Empty;
public Server(string ServerName)
{
this.serverName = Servername;
}
public void AddService( string serviceName, Service srv)
{
ServiceList.Add(serviceName,srv);
}
}
and so on...
Note code above is off the top of the head, errors likely.
[edit]
I used a HashTable, because it gives very fast lookups of the key for even large lists. With the ArrayList, lookups are linear with the number of entries, but it is easier to iterate (and to conceptualize).
[/edit]
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
I appreciate the reply. One thing is still unclear, though. How do you call up each element specifically? As with treeviews, for example, you can add or recall a specific part by using "treeView1.Nodes[15].Text", or to get to that node's child you use "treeView1.Nodes[15].Nodes[0].Text", and so on.
I understand what you mean above, but I'd just like some clarification on how to get the data at a specific point by using the indexes of the array.
-Michael
|
|
|
|
|
Note the GetServer function provided in the original example. That retrieves the server stored with the servename passed as a parameter. Hashtable stores by key, rather than index (you can get data by index as well, but this is not particularly useful as the indeces have nothing to do with the order added)
For an arrayslist, the index will be the same as the order added.
items in a hashtable are DictionaryEntry objects: a key and value pair,
and the 'indexer' is the key value (can be any object that supports GetHashCode() and Equals()- string, Int32, etc. wotk fine) the indexer returns a generic object reference to the value originally associated with the key
So, if tbl is the Hashtable name:
Server s1 = new Server("server1");
tbl.Add("server1",s1);
Server s1 = (server)tbl["server1"];
For an Arraylist, indexing is by integer indx, just like an array, and what is
returned is a generic object reference. So, if Arr is the Arraylist of Server objects:
Server s1 = (Server)Arr[0];
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
I created a master detail datagrid. It works fine and displays all the information i want. The problem i have is with a asp:button which is not part of the datagrid but in the same form. this button doesnt fire when i hit.just like a submit button This button should redirect me to a new page. This button does nothing else butr take me to new page. Could any one help me with this proble.
Srinivas
|
|
|
|
|
Does it have runat="server" ? It's not a submit button, is it ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi Christian Graus,
It is a submit button. It is a web control and not a htmlcontrol and it has a runat=server. If i dont have a datagrid on it. The same button works perfect.
Actually this is the complete task what i want to do. In this master detail datagrid i have populated using codebehind and sql queries. the detail grid has a column with checkboes. when i enable these check boxes and click submit button. The values should go as querystring to the redirected page.
Display of the datagrid is perfect with all the information i want. I am frustrated as i was sitting on above functionality for a week now. what ever i try it doesnt work. there are hyperlinks outside this form on the page and they also work perfect.
Regards,
Srinivas
|
|
|
|
|
You shouldn't be creating your own forms on an asp.net page, it messes with the framework
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I had this idea of creating altogether a new form from scratch and putting the current datagrid where i intended to in the new form. Thanks for the idea. Man its lot of work. Believe me each and every step is mystery in .NET.
Srinivas
|
|
|
|
|
Hey,
The button is working now after i created a new form an copy and pasted each bit of code. It redirects to a new page.
Thanks very much
Srinivas
|
|
|
|
|
Srinivas Jonnalagadda wrote:
Man its lot of work. Believe me each and every step is mystery in .NET.
It's a learning curve, your best best is to not mess with any traditional HTML, just use the .NET server controls, and don't add any forms.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello,
I need a collection that works much like ArrayList , dynamically sizable, allowing me to add and remove items, either at the end or in the middle.
The problem with an ArrayList is that it causes boxing/unboxing of the value types, and this degrades performance. A simple array is not dynamically sizable.
Any ideas? For the moment I'm stuck with ArrayList , but I'd like to know if there's something better.
Thanks,
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
maybe your looking for a hashtable?
|
|
|
|
|
Well i dont know if this will solve your problem, depends on how often you add to the list.
But if you read the list often more rarely changeing its size
you could use the ArrayList.ToArray() method
it works this way
struct MyStruct
{
public string name;
public string age;
}
public class WebForm6 : System.Web.UI.Page
{
ArrayList list = new ArrayList();
private void Page_Load(object sender, System.EventArgs e)
{
MyStruct s = new MyStruct();
s.name = "firstPerson";
s.age = "45";
list.Add(s);
s = new MyStruct();
s.name = "secondPerson";
s.age = "27";
list.Add(s);
MyStruct[] sArray = (MyStruct[])list.ToArray(typeof(MyStruct));
Response.Write(list.Count + " list.Count ");
Response.Write(sArray.Length + " sArray.Length ");
Response.Write(sArray[0].name + " sArray.name ");
Response.Write(sArray[1].name + " sArray.name ");
Response.Write(sArray[0].age + " sArray.age ");
Response.Write(sArray[1].age + " sArray.age ");
list = new ArrayList(sArray);
s = new MyStruct();
s.name = "thirdPerson";
s.age = "15";
list.Add(s);
sArray = (MyStruct[])list.ToArray(typeof(MyStruct));
Response.Write(list.Count + " list.Count ");
Response.Write(sArray.Length + " sArray.Length ");
Response.Write(sArray[0].name + " sArray.name ");
Response.Write(sArray[1].name + " sArray.name ");
Response.Write(sArray[2].name + " sArray.name ");
Response.Write(sArray[0].age + " sArray.age ");
Response.Write(sArray[1].age + " sArray.age ");
Response.Write(sArray[2].age + " sArray.age ");
}
I know there it takes a bit work for the cpu to convert back and forth when adding and removing items
but you'll have all methods of an arraylist when editing the content of your Array
and you can access the variables or properties without unboxing every time you read from the aray
Hope this helps
|
|
|
|
|
I think this might work. It's not the complete solution I'm looking for, but this might improve performace a little. I only add items to the ArrayList on user actions, so it's not that much of a problem. But then I use them for sorting, and with many items, the unboxing can become slow.
I'll keep looking into it, but thanks for the pointer!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Luis Alonso Ramos wrote:
The problem with an ArrayList is that it causes boxing/unboxing of the value types, and this degrades performance. A simple array is not dynamically sizable
Generics .
ArrayList is array... on power-ups. Judging by operations you need (add/remove) you can have growable array - array that doubles (allocate new array + move all items ) it's size everytime it is full. That is how ArrayList internaly works, too.
David
"Stay Kul And Happy" I.A.
|
|
|
|
|
dnh wrote:
Judging by operations you need (add/remove) you can have growable array
I also need insert. I think it could be implemented more or less like a linked list, but then it complicates everything.
For now, I was doing a foreach(int i in ArrayList) in every comparison. I changed the comparer object to get a real array in the constuctor, and do the foreach(int i in array) and it speeded things up by 18%.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I dont know if you are using primitive value types or structs.
But if you use struct you could implement the Icomparable in the struct, and thereby avoid boxing and unboxing when sorting
struct MyStruct : System.IComparable
{
public string name;
public int age;
public static enuSortOrder mySortOrder;
public static enuSortOrder SortOrder
{
get
{
return mySortOrder;
}
set
{
mySortOrder = value;
}
}
public enum enuSortOrder
{
Name,Age
}
public int CompareTo(object obj)
{
switch (mySortOrder)
{
case (enuSortOrder)enuSortOrder.Name:
{
string x = this.name;
string y = ((MyStruct)obj).name; // DESC
return x.CompareTo(y);
}
case (enuSortOrder)enuSortOrder.Age: //DESC
{
int x = this.age;
int y = ((MyStruct)obj).age;
return x.CompareTo(y);
}
default: break;
}
return 0;
}
public override string ToString()
{
return "Name: " +this.name + "Age:" + this.age;
}
}
public class WebForm6 : System.Web.UI.Page
{
ArrayList list = new ArrayList();
private void Page_Load(object sender, System.EventArgs e)
{
MyStruct s = new MyStruct();
s = new MyStruct();
s.name = "secondPerson";
s.age = 27;
list.Add(s);
s.name = "firstPerson";
s.age = 45;
list.Add(s);
Response.Write(list.Count + " list.Count ");
Response.Write(((MyStruct)list[0]).ToString() + " Unsorted ");
MyStruct.SortOrder = MyStruct.enuSortOrder.Name;
list.Sort();
Response.Write(list.Count + " list.Count ");
Response.Write(((MyStruct)list[0]).ToString() + " Sorted ");
}
just add more variables in the enum and conditions in the swicth like NameASC,AgeASC and so on
Hopfully im not waisting your time with my suggestion
|
|
|
|
|
I'm using primitive types (int s). Actually I'm implementing multi-column sorting for a list view control (it will come as a CP article ) and I have to keep track of all columns clicked by the user. If the user clicks one column, clicks another one, and then click the first again, I have to remove it from the list and add it again at the end. Also if the user clicks twice in a row the same column, I have to togle its sign (indicating descending order.)
So, when I create a comparer object to set the ListViewSorter (or something like that) property, I pass this ArrayList as a parameter, and each time Compare is called to compare two items, I have to compare the items according to the columns in the order they are in the ArrayList . Bsically I used a foreach(int i in ArrayList) and compared the subitems in column i , and if they were the same, checked the next column.
After your first suggestion, in the constructor I converted the ArrayList to a regular array, and the same code (measured with a profiler) runs about 18% faster.
Wyxlwiis wrote:
Hopfully im not waisting your time with my suggestion
Not at all. I appreciate it very much. Thanks!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
What you need to do any better is Visual Studio 2005 and CLR 2.0. That gives you typed arrays which do not do boxing or downcasting.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
I'm using DataBinding to create a software. I use wizard to create many data form. How I can reuse OleDbConnection to create one and use it in many form that i can still using wizard with OleDbDataAdapter.
Nothing
|
|
|
|
|