|
Hi,
Is it possible to load data from excel spreadsheet to sql server using c#
without giving names in column header
for example:The Spreadsheet looks like below(No Header Names)
A B C
================================
Mark Asst.Professor 25
Thomas SoftwareProfessional 30
Assiging Column Header values to sql server table called employeefields .
A = Name
B = Designation
C = Age
There will be table called Employees which contains columns such as Name,Designation,Age
Based on the fields chosen in Employeefields the records must be inserted in the Employees table in sqlserver
modified on Sunday, September 13, 2009 6:22 AM
|
|
|
|
|
You can create OleDB connection to the excel sheet. Make sure to have HDR=No; set in the connection string. Then you can insert the data in SQL table using insert statement.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I have an application which involves creating a set of randomly generated numbers that are included in the document to be printed.
Prior to printing I am displaying the document(s) in a PrintPreview form constructed with a PrintPreviewControl.
There is a button on the form which calls up a printer dialog and the document is then printed on ok click on the printer dialog after pages to print selection etc.
The problem I am having is that, to display the document in the PrintPreview form the random numbers are generated in the calling form and the printDoc_PrintPage function then formats the document using the random numbers that have been put in an array.
This is fine.
But when I click to print the document, the printDoc_PrintPage function is called again to generate the document for the printer but the array of random numbers is now cleared and so an error is thrown.
I could put the generation of the random numbers within the the printDoc_PrintPage function, but the output would then be different between the printPreview display and the printed paper document.
I don't want to have to pass the array back and forth between the forms.
The printPreview form is used for assorted documents in various places in the application and should be kept generic and should only need a printDocument.
Does anyone have any suggestions as to how I might get around this problem please?
I would think many people would like to have a 'completed' document to pass around but it seems that the only option is to create the document on the fly for each call to print.
I can't see how you can achieve this without persisting the document to a file.
I might be missing something simple here or misunderstanding how to use these components but I can't find any examples of similar use.
Thanks
|
|
|
|
|
You don't have a whole lot of choices:
1) Pre-generate the random numbers and pass the array through - which you don't want to do (why not?)
2) Use a common seed for your random number generator, so it gives the same random sequence each time.
3) Persist the document to a stream of some sort (memory or file).
Why would you want to print random numbers?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thanks for your (very fast) reply.
The random numbers are for bingo cards, so the document contains many sets of them for which I had to seed it to make sure they were different.
It doesn't seem right to me that you should have to pass the data to generte the document back and forth to a printPreview form.
I suppose I'll have to go and have a think about what to persist and where.
Cheers
|
|
|
|
|
I see. Then what I would do is construct a card class, and pass the random data to it as the constructor. (The default construcutor could generate this from a random seed as well.) Since the data is only ever relevant to the card, I would then pass the card(s) I wanted to print to the print and / or print preview. A document would then consist of as many cards as would fit on a sheet.
You aren't then passing the data to generate the document back and forth, you are passing the document.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Yes, that is basically what I am doing.
I have been being a dozy twonk and I have now spotted my mistake.
I have a reset form that is clearing down the list after the printPreview form is loaded.
(I'm abit over tired that's my excuse)
I'll just have to rethink when and where to do the resetting from.
Well thanks for helping me focus.
|
|
|
|
|
Hey ppls I was finalizing my POS system for Cafteria and Restaurant. But I dont get the Idea of VOID order ............ can any body tell me how to add this function to my system(just the idea).
Thank you
|
|
|
|
|
matiIsGreat wrote: But I dont get the Idea of VOID order
Neither do I, please clarify your question.
|
|
|
|
|
Ok to make it clear. What are the steps to enter a VOID order(i.e if the customer dont want the item after an invoice was made and the data was intered in to the system) into my system. .... is that a little bit clear now??
Thank you.
|
|
|
|
|
Are you talking about when:
1) The customer has arrived at the checkout.
2) The products have been checked, and entered to the system.
3) The total cost has been presented to the customer.
4) The customer cannot (or will not) pay for the goods.
5) The order must be voided, without invoices being raised.
If so, then it depends on the local law and store practices. Do you have to raise an invoice, and void it? Or just cancel the generation of an invoice without using an invoice number? Who can perform the void? Is this a supervisor function?
If not, then what are you talking about?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
almost as u said .......... but just to have a good name(i.e the company 4 whom I am developing this software) even if the invoice is given and if the customer dont wants some of the items(in my case if the customer dont want to drink a coffee instead he wants Milk) ..... the invoice must b returned to the Restaurant and another bill will b made for the cusotmer.... But if the the owner of the company is not there @ that time ........ the cashier may put some one in his/her pocket & they will say it is a VOID order ........... Inorder to avoid this Problem the system must have something related to VOID(i.e @ the end of the day when the GrandTotal is calculated it must have to include the VOID order inorder to come with the right balance) ..........
I think i express it well ............ Please just through just ideas if u got it....
Thank u for ur respond
|
|
|
|
|
It's is a little more complex than that, as there are legalities to be observed (in most countries). For tax reasons, once an invoice is complete, you must not alter it. You can cancel it, and issue a negative invoice against it if it has been paid, but it must remain on the system as an invoice - otherwise you are using the same invoice number for different amounts, or have missing invoice numbers. Both of these upset Tax authorities for some reason!
You best bet is to describe the problem to your customer, and ask what procedures his company already uses when the situation occurs. Follow that in code and no-one can get upset - or at least not with you! If you try to handle it "intelligently" then it will likely conflict with the customer way of working, or with the Tax office way of working. Niether gets your bill paid at the end of the day!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
so u are saying that the system should have no VOID ..... and to tell the customer we are sorry.
/........By the way the sysem I am developing is not taxable system for @ least a year.... it may b taxed after that ........
|
|
|
|
|
matiIsGreat wrote: so u are saying that the system should have no VOID ..... and to tell the customer we are sorry.
No, talk to the customer and ask how he handles it at the moment. Then implement that. Never tell a customer you are sorry - they may lower your payment!
matiIsGreat wrote: the sysem I am developing is not taxable system for @ least a year.... it may b taxed after that
Assume it will be tax audited. That way if it isn't, you are ok, and if it is you are still ok! If it may become taxable in a years time, it is a good idea to have the procedures in place now - rather than have to make radical changes to a working system that people have got used to.
It is always a good idea to plan what changes are likely and develop to meet those changes. Difficult, but a good idea!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
OriginalGriff wrote: If it may become taxable in a years time, it is a good idea to have the procedures in place now
That is a good idea ..... but this is a business so if u do every thing now .... u will not be needed 4 other time ..... so i better put things 4 future which r not useful now ..
thank u.
|
|
|
|
|
Uhhh...I really hate to say this but this should have been covered in the specifications/requirements meeting with the customer. You shouldn't be asking this question at the end of the project. This should have been one of the questions you asked before you ever wrote a single line of code, even before you sat down to design this thing.
|
|
|
|
|
Thanks dude ....... that was ma mistake ... i hope it will never be repeated like that again
Tnx a lot
|
|
|
|
|
Hello,
I have many tab pages in my tabcontrol.
The tabpages are shown in one line.
How can i do so the tabpages will be in 2 lines (for example 5 in the upper and 5 in the lower etc)?
|
|
|
|
|
Have a look at this:
private void Form1_Load(object sender, EventArgs e)
{
TabControl tabControl1 = new TabControl();
TabPage tabPage1 = new TabPage();
TabPage tabPage2 = new TabPage();
TabPage tabPage3 = new TabPage();
TabPage tabPage4 = new TabPage();
TabPage tabPage5 = new TabPage();
Label label1 = new Label();
tabControl1.Multiline = true;
tabControl1.SizeMode = TabSizeMode.FillToRight;
tabControl1.Padding = new Point(15, 5);
tabControl1.Controls.AddRange(new Control[] {
tabPage1, tabPage2, tabPage3, tabPage4, tabPage5});
tabControl1.Location = new Point(35, 65);
tabControl1.Size = new Size(220, 180);
int rows = tabControl1.RowCount;
label1.Text = "There are " + rows.ToString() +
" rows of tabs in the tabControl1 tab strip.";
label1.Location = new Point(35, 25);
label1.Size = new Size(220, 30);
Size = new Size(300, 300);
Controls.AddRange(new Control[] { label1, tabControl1 });
}
zafer
|
|
|
|
|
You could try Google[^]
You could try reading the documentation[^]
You could try reading the "how to get an answer to your question" at the top of the page.
All of these are quicker than "post and pray"
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
I'm currently writting a web service with sessions. I have a few methods like (getPrivileges) that need to read from Session[], but that I would not like to have them visible to outside requests.
The question is: how do I read a Session[] value (like Session["id"], or whatever) on a method that is not a WebMethod?
Best regards
Fratelli
|
|
|
|
|
AndreFratelli wrote: The question is: how do I read a Session[] value (like Session["id"], or whatever) on a method that is not a WebMethod?
You mean those methods which are not exposed as Web Method ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Abhijit Jana wrote: You mean those methods which are not exposed as Web Method ?
Exactly
Fratelli
|
|
|
|
|
I am in need of some guidance of how to carry out a specific task I need to perform...
I have a database table that contains requests made by users for excel spreadsheets.
In that table there is a status column which indicates the step the request is in.
I need to write a service of some sort that will be able to keep checking the status column of that table.
When it finds a record that contains the status it is looking for, it should pull the data from the record and call another application which creates the excel spreadsheet.
(NOTE: I have written a program that contains a class which creates an excel spreadsheet and saves it to the local hard drive. All of this will be hosted on the same server)
Thanks in advance!
|
|
|
|