|
hi
how to save image into database with Datarow ? my db is sqlserver 2000 . i can insert and update value in db with Datarow but i can't save Image in db with Datarow .. how to do that ??
|
|
|
|
|
Hi
i am using .NET 1.1.
I am populating some data in DataTable using StoredProcedure.
DataTable dt = new DataTable();
DataRow dr;
DataSet ds = GetDataFromSP();
for (int k=0;k{
dr = dt.NewRow();
dr[0] = int.Parse(ds.Tables[0].Rows[k]["ID"].ToString());
dr[1] = ds.Tables[0].Rows[k]["COL1"].ToString()
dr[2] = ds.Tables[0].Rows[k]["COL2"].ToString()
dt.Rows.Add(dr);
}
//Binding to Grid using dt.
In this DataTable(dt) with same primary key multiple rows are returning by SP.
i want to check DataTable weather with this primary key is there any dupliate entry. if entry exists in DataTable, avoid the adding into the dt.
how to do this?
any sounds appriciated. awaiting for response.
regards
GV Ramana
|
|
|
|
|
Hi,
I have found som code on the Internet, which should export my datagridview to Excel. It also do that BUT it only export 4 of my 5 columns to excel (it's column number 4 it doesn't export which is Produkter.PrisExMoms from the database).
The code I use to export is:
#region Fakturalinier
int rIndex = 12;
foreach (DataRow row in dtOrdrelinier.Rows)
{
rIndex++;
int cIndex = 0;
foreach (DataColumn col in dtOrdrelinier.Columns)
{
cIndex++;
xlApp.Cells[rIndex + 1, cIndex] =
row[col.ColumnName].ToString();
}
}
}
#endregion
The code where I put the 5 columns into my datagridview:
#region FelterIDataGridView
// Databinding for the Grid
da2 = new OleDbDataAdapter("SELECT Ordre.Antal,
Ordre.VareNr, Produkter.Varenavn, Produkter.PrisExMoms FROM Produkter INNER
JOIN (Faktura INNER JOIN Ordre ON Faktura.FakturaID = Ordre.FakturaNr) ON
Produkter.VareNr = Ordre.VareNr WHERE FakturaID=@fakid", cn);
da2.SelectCommand.Parameters.Add("@fakid",
OleDbType.Integer);
da2.SelectCommand.Parameters["@fakid"].Value = fakid;
//create datatable
dtOrdrelinier = new DataTable();
//fill datatable
da2.Fill(dtOrdrelinier);
//create colum to hold the sum of other two colums
DataColumn col = new DataColumn("RaekkeBeloeb");
col.DataType = typeof(System.Decimal);
col.Expression = "Antal*PrisExMoms";
//add the colums
dtOrdrelinier.Columns.Add(col);
//bind datatable to grid view
dgrOrdre.DataSource = dtOrdrelinier;
#endregion
Anyone who can see why the column 4 (Produkter.PrisExMoms from the database) doesn't export to excel with the other columns?
Kind regards,
simsen
|
|
|
|
|
I found out, that the problem didn't was in the code, but in excel, where I had merged 2 columns together in the rows, where the datagridview should be.
I worked around the problem with the following code:
#region Fakturalinier
int rIndex = 12;
foreach (DataRow row in dtOrdrelinier.Rows)
{
rIndex++;
int cIndex = 0;
foreach (DataColumn col in dtOrdrelinier.Columns)
{
cIndex++;
if (cIndex == 4)
{
cIndex++;
}
xlApp.Cells[rIndex + 1, cIndex] = row[col.ColumnName].ToString();
}
}
#endregion
simsen
|
|
|
|
|
I want to make a mobile agent that travels from one machine to the other with data and code. the mobile agent interacts with the respective distination computer and fetch the results back to the invoking server system. how can i do that. kindly give me some example code as i am a student of MS and familiar to C# but totally new to mobile agent programming.
thanks
shah khalid
|
|
|
|
|
I want my software to be installed only after the installtion key provided by me. please tell me how can i do that.
I have developed my project in C#.net and I am using Visual Studio.net 2003.
shah khalid
|
|
|
|
|
Hi.
Is there any way that an instance can return a value (like functions do) to another instance.
Regards.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
I think, what you want is "Property"
|
|
|
|
|
stancrm wrote: I think, what you want is "Property"
Thanks stancrm,
Tried it, but not getting required result.
Actually i'm calling Form2 from Form1 . After finishing Form2's function, a value is required from it, so that Form1 can continue its process. I think its more clear now.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
uroojkhan wrote: I think its more clear now.
Not really.
Perhaps you could chose the correct terms?
Right now one can only guess what you mean (for example "After finishing Form2's function" - are you calling a method on an instance of Form2? If so, why do you have problems returning a value from this method?)
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
mav.northwind wrote: are you calling a method on an instance of Form2?
No! calling the Form2 for entering a new record in the database. when the record is inserted there is no need to keep it. But here i need the newly iserted record's IDnumber (which is a primary key value) in the Form1, so that it can be inserted as FK in another table from Form1.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
Oh boy, you should seriously start reading on OOP so that you can use the correct terms, otherwise people don't know what you're talking about.
I guess what you do is to create and show a dialog instance to perform some DB operations.
Then, when the dialog is closed and control is returned to the caller, you want the caller to be able to access some data Form2 received during the DB operations, right?
You simply have to add a publicly visible property to your Form2 class and set it's value after the insert has been performed.
Then you can query this property from the calling form.
Or you use events for this purpose if you don't want to show Form2 as a modal dialog.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Thanks mav.northwind.
The article Passing Values Between Forms (SiblingToSibling part) solved my problem.
Thanks alot for your response and
Best Regards.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
mav.northwind wrote: You simply have to add a publicly visible property to your Form2 class and set it's value after the insert has been performed.
Then you can query this property from the calling form.
Its also working. First I tried this technique, but there was my mistake (value assignment to the property on wrong place, which yields nothing). Now its fixed.
Thanks and Regards.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
|
|
How to open tabpage when click mouse-right button?
|
|
|
|
|
Hi all
Can anybody send me a sample code how to upload a file to VSS to a specified directory using c#???
Thanx
Akhil
|
|
|
|
|
You dont upload to VSS, you 'Check-In'.
|
|
|
|
|
Hi
In my application i am trying to send a mail through outlook
.. the problem is when i try to send the outlook first displays a security alert.. Can anybody suggest a way to avoid this warning ???
Thanks
Akhil
|
|
|
|
|
Don't send mail through Outlook.
The reason this security alert was added was to try to limit the spread of email-borne viruses. If you're trying to send email, use the classes from the System.Net.Mail namespace (from .NET 2.0) or System.Web.Mail (any version, but uses CDO rather than an implementation of the SMTP protocol).
|
|
|
|
|
How can i create Setup and Deployment project for an application usingVisual Studio 2005 (Profesional Edition)?
Thanks for consideration.
|
|
|
|
|
Just create a new project. You'll find several project types under "Setup and deployment".
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
when my appliction starts the process comes up and runs
but in case that the process is exited abnormally by program errors or exceptions, the process wouldn't be killed.
so, now i coded like the below..
**************************************
Process[] erssProcess = Process.GetProcessesByName("ERSS.WinUI");
if (erssProcess.Length > 1)
{
MessageBox.Show("The Proccess is running. Please kill the running process first");
return;
}
**************************************
but that's not enough. i like to kill the previous process and run the new process.
i don't know how to distinguish the first process and the second process.
please help~~
|
|
|
|
|
Get the process ID (the number) not the name from the other process and kill it.
|
|
|
|