|
Hi
I am fetching the data from excel sheet and import it into the sql server.
But if i have a worksheet which may contain 10 columns.
Now i want the data from certain columns say column 1, column 5, column 6, and Column 8, column 10, then how can i write the query for this?
Thanks In Advance
|
|
|
|
|
Last time I had to do something like this... thousand of rows in excel files to insert into an Access DataBase...
What I did was.
First, create a typed dataSet with the structure of the Target Tables... ( autogenerate the Insert Command ).
Now the problem is only to fill the DataSet.
Two ways.
First Open the Excel with the COM Object for Excel... and go column by column.... bla bla... and create a row of the DataSet for each row in the Excel file.... and so on..
Second, Export the Excel file to a CSV file and open the txt file from your application and open the file, read line by line and do a split using the ',' the comma, after that do a loop for each line creating a new row of the DataSet...
If there are many lines in the excel files, I recomend you to update every 100 or 200 rows...
Regards
Ricardo Casquete
|
|
|
|
|
Hi
I have one GridView and in this gv i have two column one is mark-printer other is model-printer.So i done this column like template but i don't know how to do exchanging of data when i doing edit???I mean if i choos for example "HP" i want to see only models for hp not all how to link both controls pleas help me.
Good bye best regards
|
|
|
|
|
Hi there,
I'm have a little problem with my page caching. On my admin side, I have a list of members. Lets say I want to update member Dean Martin, then I would click on his name and it takes me to an update page, I will change his last name to something like Martinn. The message displays that the member has been updated successfully. Then I have a link that goes back to the members listing, then it still displays as Dean Martin. I have to press CTRL + F5, then it will only update to Dean Martinn. I don't want to do this.
Each of my pages extend from a base page, and in the load up of this page is does the following:
this.Response.Buffer = true;<br />
this.Response.Expires = 5;<br />
this.Response.ExpiresAbsolute = DateTime.Now.AddMinutes(5);<br />
this.Response.ContentType = "text/html";<br />
this.Response.CacheControl = "private";<br />
this.Response.AddHeader("Pragma", "no-cache");<br />
this.Response.AddHeader("Cache-Control", "Private");<br />
Could this maybe be the problem? Am I doing it right or wrong? Can someone please help me with this problem that I am having??
Regards,
ma se
|
|
|
|
|
hai,
iam working with c# windows application. i want to delete a record from the data grid using delete button. how can that be done if any one have code pls help me.
|
|
|
|
|
hi rajaaa.please try this code is working perfect on my system.
try
{
DialogResult dr=MessageBox.Show("Are you sure you want to delete this row ? ", "Confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr ==DialogResult.Yes)
{
DataTable myTable =new DataTable("Transactions");
myTable=this.dataSet11.Tables["Transactions"];
myTable.Rows[dataGrid1.CurrentRowIndex].Delete();
sqlDataAdapter1.Update(myTable);
}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
jacob bahula
|
|
|
|
|
How would i go about creating a Parameter containing an object (TypeCode.Object) to pass to an update method of a ObjectDataSource.
When I create a new Parameter it won't allow me to set it's value to an object even though I set it's type to object.
Thanks in advance!
|
|
|
|
|
Any code example?
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
<br />
MyClass myClass = new MyClass;<br />
MyClass.Field1 = "A value";<br />
MyClass.Field2 = 2;<br />
MyClass.Field3 = false;<br />
ObjectDataSource1.UpdateParameters["myClass"] = myClass; <-- Will not accept this as a parameter value.<br />
Hope that makes some sense of what I'm trying to do
|
|
|
|
|
i want to know about the concept of internet TV/Radio. i have a net connection and TV tuner card then how i get.
ranandbe
-- modified at 3:30 Thursday 20th April, 2006
|
|
|
|
|
???? this question has NOTHING to do with C# development! 
|
|
|
|
|
I would begin by sending an Email to Skype asking for an API to their software.
|
|
|
|
|
|
Hi
i am using following code to connect to ftp server on my own pc.
socket.Connect(endpoint);
then i m calling following code to read response.
noofbytes = clientSocket.Receive( buffer, buffer.Length, 0 );
when i m calling this sometimes, program hangs, it does not hang when i m debugging. so i have added System.Threading.Thread.Sleep(20) to sleep program, now its working, i want to know the reason program is hanging, and also i used 20 milliseconds after experiment. it may change on different machines.
Shajeel
|
|
|
|
|
try reading in smaller chunks
60% of statistics are made up on the spot
|
|
|
|
|
Hi everyone,
I am doing a small project in asp.net which uses MySQL as back end.there is a field to store Hours in my table.I gave the datatype of double to that field.
Now I select the contents of the table and the resultant dataset will be bound to the datagrid as usual.
Here my double Hours field is truncating the trailing zeros.If total hour is 5.30 its showing as 5.3, but for 5.15 it shows 5.15 as correctly.how to fix this.
this may be silly ...but I need help from some one......
Thanks
|
|
|
|
|
Actually no data is lost. It's just a matter on how the data is formated when being output. Have a look here[^] to get an overview of what is possible with formatting.
Generally speaking you can format your double the way you want. In your example it should be something like:
double d = 5.3
Console.WriteLine(d.ToString());
Console.WriteLine(d.ToString("#.00"));
Console.WriteLine(d.ToString("00.00"));
|
|
|
|
|
I wanted to reset the record number on beginning of odd page numbers (Not applying to the page number 1) to immediate previous even page beginning record number. Ex. if page 2(even page number) starts with record number 1, then I wanted to reset the record number to 1 in the next odd page number (i.e. 3). Similarly if page 4(next even page number) starts with record number 26, then I wanted to reset the record number to 26 in the next odd page number (i.e. 5). This should continue through out the report. Is it possible do this? Please comment on this.
Or anybody have any idea to display lengthy records (Which has several columns) runs up to 2 A4 papers in continuous order. Ex. Assume it show 25 records in the first page and remaining columns same 25 records in the next page. Then it should show the records from record number 26 at the next page. This should continue through out the report.
Thank you in advance.
Sam J
|
|
|
|
|
Hi..
Crystal does have global variables for pagenumber, or force reset of pagenumber, and you probaly have to to do this check and reset on the page header or footer group.
.NET Rules
|
|
|
|
|
I tried that. But the record number is a read only value. Isn't it? So how to set a value to it even though the check can be done at the page header?
Sam J
|
|
|
|
|
how would i initialize a static array?
|
|
|
|
|
Either in a static constructor or inline:
static int[] intArray[] = { 1, 2, 3 }; I hope this helps!
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
Hello everybody
I'm trying to scale down a image file, the thing is that I can't find anyway to do that without getting the image into a Grapgics object.
Using the graphics object to scale down is easy (using ScaleTransform()), the thing is that I want to convert back to Image in order to place the image in a picturebox.
can anyone help me with that???
Thanks in advance!
|
|
|
|
|
Instead of changing your instance you could create a new one:
Image oldImage;
Image newImage = new Bitmap(wantedWidth, wantedHeight);
using (Graphics g = Graphics.FromImage(newImage))
{
g.DrawImage(oldImage, 0, 0, wantedWidth, wantedHeight);
}
|
|
|
|
|
how can i change the machine name using C# code?
|
|
|
|