|
Member 2458467 wrote: nothing is hunting download my code because I want to share them with people like me that is the case
That made no sense at all. I have no idea what you're trying to say.
|
|
|
|
|
I am be an error importing the Excel2007: "Not a legal OleAut date", you see my code below:
public static void ImportToSql(string excelfilepath)
{
string ssqltable = "TABHD";
string myexceldataquery = "SELECT * FROM [dbo_TABHD]";
try
{
string sexcelconnectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" + excelfilepath + "; Extended Properties=\"Excel 12.0; HDR=Yes; IMEX=2\"";
string ssqlconnectionstring = @"server = itfriend;Database=HD;integrated security = true";
string sclearsql = "delete " + ssqltable;
INSERTING IT.INSTEAD I WANT TO UPDATE TABLE DATA"
SqlConnection sqlconn = new SqlConnection(ssqlconnectionstring);
OleDbConnection oledbconn = new OleDbConnection(sexcelconnectionstring);
OleDbCommand oledbcmd = new OleDbCommand(myexceldataquery, oledbconn);
oledbconn.Open();
OleDbDataReader dr = oledbcmd.ExecuteReader();
SqlBulkCopy bulkcopy = new SqlBulkCopy(ssqlconnectionstring);
bulkcopy.DestinationTableName = ssqltable;
bulkcopy.WriteToServer(dr);
Console.WriteLine(".xlsx file imported succssessfully into database.", bulkcopy.NotifyAfter);
oledbconn.Close();
}
catch (Exception ex)
{
//handle exception
MessageBox.Show(ex.Message.ToString(), "Warning !");
}
}
|
|
|
|
|
Somewhere in your Excel sheet that you're trying to import there is an invalid date.
It's not that hard to figure out. All you have to do was copy and paste the exception message into Google and you would have had your answer in about 5 seconds.
|
|
|
|
|
if i change string sexcelconnectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" + excelfilepath + "; Extended Properties=\"Excel 12.0; HDR=Yes; IMEX=2\""; of execl 2007 as excel 2003 and file excel 2003(note conten like it), it's not warning error: "Not a legal OleAut" and import excel2003 into SQL Server very good, why excel 2007 be warning ?
Excel connection strings
https://connectionstrings.com/excel/
|
|
|
|
|
Those connection strings are identical.
I have no idea what this means:
Member 2458467 wrote: of execl 2007 as excel 2003 and file excel 2003(note conten like it),
|
|
|
|
|
file Excel2007 and file excel2003 the same content, that is since I use Office2007 file excel2003 to convert to file Excel2007, have you got test my code ?
modified 19-Sep-14 2:33am.
|
|
|
|
|
I create a program play video by C#, using VLC library. But I dont know how to make the text on the video in the form when it is playing.
I try to use label but it has back color with the text. It is not nice.
How can I make the text on the video? Pls help me...
|
|
|
|
|
|
Hi,
Is it possible to create an encrypted xml using C# without having to decrypt it everytime I want to insert or read from it?
I want to store my application connection string passwords and email credentials in that file.
Thanks,
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
No.
Think about it: why do you encrypt a file? To prevent people from reading it's content. If you could read it without decrypting it, so could anyone else, and it wouldn't be encrypted then, would it?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
sorry what I wanted to say is without decrypting the physical file so decrypting will be on my application level not the actual physical file.
Technology News @ www.JassimRahma.com
|
|
|
|
|
So decrypt it to a MemoryStream then pass that to your XML.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Jassim Rahma wrote: connection string passwords and email credentials Look at the connectionStrings region of the app.config file. You can tell the .Net framework to encrypt that part, e.g. by
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.ConnectionStrings.SectionInformation.ProtectSection(null);
config.Save(ConfigurationSaveMode.Full, true);
When the application needs to access the "decrypted" information, that is automatically handled by the framework.
|
|
|
|
|
I heard Klocwork is for C,C++. I have used Resharper and liked it too. But feature wise I am not able to decide between the two.Can Klocwork can be used for C# too?Any light on the same with proper facts would be greatly appreciated.
Subha.A
|
|
|
|
|
|
Klocwork is a static source-code analyzer for C/C++/Java. It will not work with any .NET language.
ReSharper is a .NET specific dynamic programming enhancement tool ... it works alongside Visual Studio 20xx ... at design-time.
I purchased ReSharper, and use it for work in C#, and highly recommend it.
« I had therefore to remove knowledge, in order to make room for belief »
Immanuel Kant
|
|
|
|
|
According to their website, Klocwork Integrate works with C# as well. They even give some walkthroughs of things they work on. Here's one[^] example.
|
|
|
|
|
Hello. I have opened media player classic with Process.Start .
* Is it possible to start mpc with DockStyle = Fill in a panel on the winform?
* Is it also possible to hide all the menus on it?
Thanks for any pointers.
|
|
|
|
|
The window doesn't belong to your process so "DockStyle" doesn't apply to it at all.
It's possible to change the parent window of the process to your Panel, but since it's a separate process it's NOT under your control. Users can do anything they want with it as if it was running on the Desktop without your application, even moving the window around inside your panel!
There is a MediaPlayer control in the Toolbox that you will have far more control over.
modified 15-Sep-14 7:28am.
|
|
|
|
|
I'm using the Graphics.DrawString() method to put some text onto a bitmap that I create on the fly.
The problem is that the text comes out looking blocky and pixelated, not like a true-type font at all. What could I be doing wrong?
I've simplified the code below, but it shows how I'm drawing the text:
using (Graphics G = Graphics.FromImage(Chart))
{
using (Pen P = new Pen(Color.LightSlateGray))
{
using (SolidBrush B = new SolidBrush(Color.Black))
{
using (Font F = new Font(new FontFamily("Arial"), 9f, FontStyle.Regular))
{
G.DrawString((ScaleBaseY + LineCount).ToString(), F, B, (float)(UsableSizeX + 2), (float)Y);
}
}
}
}
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I think you're missing
G.TextRenderingHint = TextRenderingHint.AntiAlias;
/ravi
|
|
|
|
|
That's *much* better. Thanks!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
NP! If you'd like to take advantage of Cleartype (at the expense of a slight performance hit), use ClearTypeGridFit . This is the highest quality mode.
/ravi
|
|
|
|
|
Hello i want to remove a item from datagridcombocell which is use on another row in same cell like this
when i select qw2120 so on next row it will not display the same item on combo cell
how its possible?
|
|
|
|
|
what command use to export the rtf to html with already embedded image
|
|
|
|