|
how can i import an excel worksheet data to load it to my sql server table?
rone_matias
|
|
|
|
|
You can use the Odbc driver[^]. I do it often so:
1. Save your worksheet to csv file format but it must be looking like a table
field_name1 | field_name2 | field_name3
---------------------------------------
values | values | values
2. In your application you write
using Microsoft.Data.Odbc;
using System.Data;
....some code...
DataTable dt = new DataTable();
OdbcDataAdapter adapter;
OdbcConnection csvDB;
csvDB = new OdbcConnection("Driver={Microsoft Text Driver (*.txt; *.csv)}; Readonly=true;DBQ=[dir where is your file]");
adapter = new OdbcDataAdapter("SELECT * FROM [filename].csv", csvDB);
adapter.Fill(dt);
3.
foreach(DataRow dr in dt.Rows)
{
.....
with INSERT queries put it to your SQL DB.
}
|
|
|
|
|
thank you very much. now what i need to learn is how to all the worksheet names of a particular workbook and put them all in a datatable. how would i do that? need help on this.
thank you in advance.
|
|
|
|
|
U can use DTS Wizard
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
i have two dropdownlist containig dates
when i submit the dates
then c# page should enable a javascript function passing some arraylists as parameters andsome count values
then in java script function it should create a main checkbox for checking all checkboxes and
dechecking all checkboxes and some group of checkboxes
when i check only some checkboxes it should the list of checkboxes i have checked in a label box
and it also has to show the number of checkboxes checked .
all these checkboxes should be shown on webpage
|
|
|
|
|
So, what's the question ?
Best regards, Alexey.
|
|
|
|
|
Hi! I'm been searching the net for a solution to this problem.
How to convert a HTML Page to a PDF File. I've seen third party controls but most of them are
trial versions. Also I've seen those that are free but unfortunately it doesn't support Japanese
Characters.
If you guys have any ideas on how to solve this problem. I will really appreciate it. Thank you.
|
|
|
|
|
how to know the fontstyle of a character that is present in a .doc or .rtf files when the file is loaded in to the richtextbox control through openfiledialog box control.
|
|
|
|
|
Hi,
We have different activex dll , we create interop for every activex Control (developed in vb 6.0).
We used com interopility tool provided by dot net framework for creating com interop, the tool creates two dll for each acivex control. We have more than 50 AciveX Controls so for 50 Activex it creates 100 dll files.
It is difficult to maitain all dll files.
The Problem :-
I want to merge all dll files into single dll file. Tell me whether it is possible to
merge all wrapper dll into single assembly if yes then how i will do this and how to use .
Regards,
Vighnesh Ambekar
Vighnesh N. Ambekar
|
|
|
|
|
|
Thanks Jakob
Regards,
Vighnesh N. Ambekar
Vighnesh N. Ambekar
|
|
|
|
|
i want the idea or suggitions for migrating tha Oracle Data to Sql Server for this i need what are the pre-cautions i need to take .Plz provide information.If forwarded any Need full links greatfull to u. my basic coding part in C# thats why i posted in this board.
Thanks in advance
mahesh
|
|
|
|
|
hi all,
am using .net 2.0 and i am wanting to get a list of all open programs on the system, like in task mgr applications tab.
how can i acheive this pls? i dont want to get all the hidden windows and controls just the active (maximised or minimised) windows (application that are available), the parent windows if you will, not all the children that are returned from EnumChildWindows.
once i get this i can get a handle to that window
kind regards,
g00fy
|
|
|
|
|
|
that returns running processes
i just windows. i have some code that is close, i will post it when perfected.
kind regards,
g00fy
|
|
|
|
|
ok as promised and after trawling the windows api, always an excellent read.
i have this, which works nicely for my own screenshot app that is loaded with useful things.
i plan to add this to the explorer context menu so u can choose which window to capture or you can capture a region using a selection rectangle on the screen.
enough of that here is the code
of course, anyone using this will need to dllimport the requried functions
btw the reason it was failing was because i was using GeWindowText() instead of sending WM_GETTEXT.
public static Window[] EnumerateTopWindows()
{
ArrayList windowList = new ArrayList();
IntPtr hWnd = IntPtr.Zero;
Window window = null;
hWnd = GetActiveWindow();
hWnd = GetWindow(hWnd, GW_HWNDFIRST);
while (hWnd != IntPtr.Zero)
{
if (IsWindow(hWnd) && IsWindowVisible(hWnd))
{
IntPtr parentWin = GetParent(hWnd);
if ((parentWin == IntPtr.Zero))
{
string text = GetText(hWnd);
int length = text.Length;
if (length > 0)
{
if (text != "Tray" && text != "Start" && text != "Task Manager" && text != "Program Manager")
{
window = new Window();
window.Handle = hWnd;
window.Text = text;
windowList.Add(window);
}
}
}
}
hWnd = GetWindow(hWnd, GW_HWNDNEXT);
}
return (Window[])windowList.ToArray(typeof(Window));
}
private static string GetText(IntPtr hWnd)
{
int cap = 1048576;
StringBuilder buffer = new StringBuilder(cap);
SendMessage(hWnd.ToInt32(), WM_GETTEXT, cap, buffer);
return Convert.ToString(buffer);
}
kind regards,
g00fy
|
|
|
|
|
I am not sure my code,Is it right?
public class Macro_RemoveExcelDefaultGridLines
{
///
/// Excel Macro : Remove Microsoft Excel's Default Grid Lines
///
private static string _Name = "RemoveDefaultGrid";
private static string _Body =""
+ " Sub RemoveDefaultGrid()\n"
+ " Cells.Select\n"
+ " With ActiveWindow\n"
+ " .DisplayGridlines = False\n"
+ " .DisplayZeros = False\n"
+ " End With\n"
+ "End Sub\n";
public static string Name
{
get{return _Name;}
}
public static string Body
{
get{ return _Body;}
}
}
|
|
|
|
|
Just try it directly in Excel, and see what you get.
Best regards, Alexey.
|
|
|
|
|
My Excel macro is test in excel,my mean is i am not sure my c# class,I use static private variable and property,I think there is somthing wrong.
|
|
|
|
|
Old Gun wrote: I use static private variable and property,I think there is somthing wrong.
Looks like all Ok. Try this, and if you'll get trobles, change properties to functions, or make them non-static.
Best regards, Alexey.
|
|
|
|
|
I see nothing wrong with the code. Why do you think that there is something wrong with it?
If the class is only supposed to be a container for those static properties, you should make it sealed so that it can't be inherited, and make an empty private constructor to override the default empty public constructor, so that it's obvious that one should not create instances of the class.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks alexey N and Guffa,Both of you helped me.
|
|
|
|
|
Hi,Guffa,I can't understand "make an empty private constructor to override the default empty public constructor, so that it's obvious that one should not create instances of the class. ",Can you give me more tips?
|
|
|
|
|
how can i detect when a windows was added to the view. i mean for example how can we undrestand that a messagebox appear in a program. is there an api function that list all windows always?
|
|
|
|
|
Hello,
I have a Win Form name Settings where user can inout int value and save. And this form is a child form of the MainForm. now, I want that, whenever user enters new value in the child form and click Save Button, The MainForm should read the new saved XML (created by child) and turn a timer on with new interval.
I tried the following code,
MainForm myParent = this.Owner as MainForm ;
myParent.updateTimer(); // updateTimer is a public method in MainForm who read the XML file and update accordingly.
Now, i get an error message, "Object refrence is not set to an instance of an object."
I am wondering that, the same piece of code is working some other place and its not working some place. (Even in the same file. ) Can you give me any clue please.
thanks.
|
|
|
|