Gearboxes definitely don't last :)
Code quality is measured by the WTF/s a minute.
Gearboxes definitely don't last :)
Code quality is measured by the WTF/s a minute.
Hello,
I have imported a CSV file into SQL, the wizard has added this as a new table.
I am trying to run a SQL Statement to insert the data from the imported table into the one I need to use in the new data table.
However I am getting the following error.
Collapse | Copy Code
Msg 2627, Level 14, State 1, Line 4
Violation of PRIMARY KEY constraint 'PK_Customer'. Cannot insert duplicate key in object 'dbo.Customer'. The duplicate key value is (105).
The statement has been terminated.
This is my statement:
Collapse | Copy Code
INSERT INTO dbo.Customer
(custID,lastName,firstName,title,address1,address2,address3,postCode,email,fax)
SELECT ACCOUNT,SURNAME,FORENAMES,TITLE,ADD1,ADD2,ADD3,POSTCODE,EMAIL,FAX
FROM dbo.[NCCUST CSV FORMAT PFS 9.1.14];
Any pointers would be great Smile | :)
Thanks
This maybe of some use :) http://www.free-power-point-templates.com/articles/create-powerpoint-ppt-programmatically-using-c/[^]
Okay Thanks will try that! :-D
I am trying to achieve an application that is able to read in an Excel Spreadsheet (.XLS) and be able to convert/save out to a Database file (.DBF). Regards,
Okay thanks, same error occurs though with Data Source as two words.
Thanks solved that error, I am getting a different error now tho :confused: error: 'DataSource=excelFilePath;InitialCatalog=master;IntegratedSecurity' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.
Hello, I am getting an error when trying to save my XLS to .DBF. The error is: An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'. I am getting the error at this line of code: var cnn = new OleDbConnection(cnnStr);
//Connection string for SQL
var cnnStr = @"Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\file.xls;ReadOnly=1;ColNameHeader=False";
//Creates a new OleDbConnection with an argument of cnnStr
var cnn = new OleDbConnection(cnnStr);
//creates new datatable in memory to store the read excel spreadsheet.
var dt = new DataTable();
try
{
//Opens the new connection called "cnn".
cnn.Open();
string sqlConnectionString = "Data Source=Zach-PC;Initial Catalog=master;Integrated Security=True";
var schemaTable = cnn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (schemaTable.Rows.Count < worksheetNumber) throw new ArgumentException("The worksheet number provided cannot be found in the spreadsheet");
//string worksheet = schemaTable.Rows\[worksheetNumber - 1\]\["table\_name"\].ToString().Replace("'", "");
string sql = String.Format("select \* from \[{0}\]", sqlConnectionString);
var da = new OleDbDataAdapter(sql, cnn);
da.Fill(dt);
}
catch (Exception e)
{
throw e;
}
finally
{
// close resources
cnn.Close();
}
Any pointers? ;P
Regards, Glen
I think you wont be able to do: fmTest.Show(); as "fmTest" is the main/only form. Can someone correct me if im wrong.
.Show will show the form you want to display and will allow you to go back to the other window without closing it, and .ShowDialog will show the form you want to display and wont allow you to go back to the other window with out closing the new window.
Apples brand is powerful purely because it is designed to be easy to use - like plug and play it does it for you, good for people on the move. Im not a massive fan of the iOs now though.
Hello, when I started to learn C# I found that dotnetperls.com really helped to explain the basics of c#