Advertisement
Advertisement
| 04.01.2008 at 08:51AM PDT, ID: 23286188 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 04.01.2008 at 09:02AM PDT, ID: 21255283 |
1: 2: 3: 4: 5: 6: 7: |
OleDbConnection oledb = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileName + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1';");
oledb.Open();
OleDbCommand SelectComm = new OleDbCommand("SELECT * FROM [sheet1$]", oledb);
OleDbDataAdapter DA = new OleDbDataAdapter(SelectComm);
DataTable DT = new DataTable();
DA.Fill(DT);
oledb.Close();
|
| 04.01.2008 at 12:39PM PDT, ID: 21257353 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: |
private void button7_Click(object sender, EventArgs e)
{
saveFileDialog1.Filter = "Solo Excel (*.xls)|*.xls";
saveFileDialog1.FileName = "*.xls";
//saveFileDialog1.InitialDirectory.
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
System.IO.StreamWriter sw = new System.IO.StreamWriter(saveFileDialog1.FileName);
sw.WriteLine("<?xml version='1.0'?>");
sw.WriteLine("<?mso-application progid='Excel.Sheet'?>");
sw.WriteLine("<ss:Workbook xmlns:ss='urn:schemas-microsoft-com:office:spreadsheet'>");
sw.WriteLine(" <ss:Styles>");
sw.WriteLine(" <ss:Style ss:ID='1'>");
sw.WriteLine(" <ss:Font ss:Bold='1'/>");
sw.WriteLine(" </ss:Style>");
sw.WriteLine(" </ss:Styles>");
sw.WriteLine(" <ss:Worksheet ss:Name='Sheet1'>");
sw.WriteLine(" <ss:Table>");
for (int i = 0; i < dataGridView1.Columns.Count; i++)
{
sw.WriteLine("<ss:Column ss:Width='{0}'/>", dataGridView1.Columns[i].Width);
}
sw.WriteLine("<ss:Row ss:StyleID='1'>");
for (int i = 0; i < dataGridView1.Columns.Count; i++)
{
sw.WriteLine(String.Format(("<ss:Cell>")));
sw.WriteLine(String.Format(("<ss:Data ss:Type=\"String\">{0}</ss:Data>"), (dataGridView1.Columns[i].HeaderText)));
sw.WriteLine(String.Format(("</ss:Cell>")));
}
sw.WriteLine("</ss:Row>");
for (int intFila = 0; intFila < dataGridView1.RowCount - 1; intFila++)
{
sw.WriteLine(String.Format("<ss:Row ss:Height ='{0}'>", dataGridView1.Rows[intFila].Height));
for (int intColumna = 0; intColumna < dataGridView1.Columns.Count; intColumna++)
{
sw.WriteLine(String.Format(("<ss:Cell>")));
sw.WriteLine(String.Format(("<ss:Data ss:Type=\"String\">{0}</ss:Data>"), (dataGridView1[intColumna, intFila].Value.ToString())));
sw.WriteLine(String.Format(("</ss:Cell>")));
}
sw.WriteLine("</ss:Row>");
}
sw.WriteLine("</ss:Table>");
sw.WriteLine("</ss:Worksheet>");
sw.WriteLine("</ss:Workbook>");
sw.Close();
MessageBox.Show("La informacion ha sido Guardada exitosamente");
}
catch (IOException)
{
MessageBox.Show("El archivo esta abierto");
}
}
}
|
| 04.01.2008 at 01:00PM PDT, ID: 21257567 |
| 04.02.2008 at 01:10PM PDT, ID: 21266933 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: |
No se controló System.Data.OleDb.OleDbException
Message="La tabla externa no tiene el formato esperado."
Source="Microsoft JET Database Engine"
ErrorCode=-2147467259
StackTrace:
en System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
en System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
en System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
en System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
en System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
en System.Data.OleDb.OleDbConnection.Open()
en uniwellProgram.Form1.button6_Click(Object sender, EventArgs e) en C:\Documents and Settings\Administrador\Escritorio\uniwellProgramCopia\uniwellProgram\Form1.cs:línea 235
en System.Windows.Forms.Control.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
en System.Windows.Forms.Control.WndProc(Message& m)
en System.Windows.Forms.ButtonBase.WndProc(Message& m)
en System.Windows.Forms.Button.WndProc(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
en System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
en System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
en System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.Run(Form mainForm)
en uniwellProgram.Program.Main() en C:\Documents and Settings\Administrador\Escritorio\uniwellProgramCopia\uniwellProgram\Program.cs:línea 17
en System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
en System.Threading.ThreadHelper.ThreadStart_Context(Object state)
en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
en System.Threading.ThreadHelper.ThreadStart()
|
| 04.02.2008 at 01:21PM PDT, ID: 21267060 |
| 04.02.2008 at 01:41PM PDT, ID: 21267285 |
| 04.02.2008 at 01:50PM PDT, ID: 21267387 |