|
hi guys, i am writing a application, i have 3 textboxes which are called "items", "Cost", and "Date". i write text into them click an "add" button then i want this data to go in to the datagrid which as columns named items, cost and date. could someone please tell what code to put in the add_click event? thanks
|
|
|
|
|
There should be an Add method for adding new rows to the datagrid.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
//Create a new instance of DataSet
DataSet objDataSet = new DataSet("TableName");
//Create a new DataRow in the DataSet
DataRow objDataRow = objDataSet.Tables["TableName"].NewRow();
//Assigning text values to their respective data columns
objDataRow["items"] = txtItems.Text;
objDataRow["cost"] = txtCost.Text;
objDataRow["date"] = txtDate.Text;
//Adding the row in the DataSet
objDataSet.Tables["TableName"].Rows.Add(objDataRow);
|
|
|
|
|
Good job doing his work for him. You didn't add any real learning value for him by doing it for him.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
this builds fine but there is null exception coming up when i try to input data on the line where the new row is created, am i right in thinking this needs a value? if so what value can i give it?
|
|
|
|
|
I am developing an application that combines images. I have one form that communicates with a webcam and another that communicates with a signature pad and the main form. My problem is that I want to display the image that my webcamm takes in a picturebox on the main form. Any ideas?
a novice
|
|
|
|
|
Ofori Boadu wrote: Any ideas?
Maybe google...
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Hi,
I am trying to select from two tables and concat two values. Thus, i should get a result of "324324234, gareth111".
SQL is below as well as the error.
SELECT UNet_Engineer.EngineerId + ', ' + UNet_Login.Username FROM UNet_Engineer, UNet_Login WHERE UNet_Engineer.EngineerId=UNet_Login.EngineerId;
DbConnection.ExecuteSelect; Exception: System.Data.OleDb.OleDbException: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.<br />
Data type mismatch in criteria expression.<br />
at System.Data.OleDb.OleDbDataReader.ProcessResults(OleDbHResult hr)<br />
at System.Data.OleDb.OleDbDataReader.GetRowDataFromHandle()<br />
at System.Data.OleDb.OleDbDataReader.GetValueBinding(MetaData info)<br />
at System.Data.OleDb.OleDbDataReader.GetValues(Object[] values)<br />
at System.Data.ProviderBase.DataReaderContainer.CommonLanguageSubsetDataReader.GetValues(Object[] values)<br />
at System.Data.ProviderBase.SchemaMapping.LoadDataRow()<br />
at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)<br />
at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)<br />
at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)<br />
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)<br />
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)<br />
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)<br />
at UNet.Manager.Database.DbConnection.ExecuteSelect(String sql) in D:\UNet.Manager\Database\DbConnection.cs:line 90
Any ideas?
Regards,
Gareth.
|
|
|
|
|
What data type is UNet_Engineer.EngineerId ? If it is numeric, you need to cast it to a string data type before attempting the concatenation. CAST(UNet_Engineer.EngineerId AS VARCHAR) should do it.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi,
I changed the SQL as you said, but it produced a new error.
SELECT CAST(UNet_Engineer.EngineerId AS VARCHAR) + ', ' + UNet_Login.Username FROM UNet_Engineer, UNet_Login WHERE UNet_Engineer.EngineerId=UNet_Login.EngineerId;<br />
<br />
DbConnection.ExecuteSelect; Exception: System.Data.OleDb.OleDbException: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).<br />
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)<br />
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)<br />
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)<br />
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)<br />
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)<br />
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)<br />
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)<br />
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)<br />
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)<br />
at UNet.Manager.Database.DbConnection.ExecuteSelect(String sql) in D:\UNet.Manager\Database\DbConnection.cs:line 90
Regards,
Gareth
|
|
|
|
|
Just thought i'd add. I am using MS Access as my db.
Regards,
Gareth.
|
|
|
|
|
gareth111 wrote: Just thought i'd add. I am using MS Access as my db.
Ah. I'd assumed you were using SQL Server. The syntax I provided is specific to T-SQL and won't work in Access.
My Access knowledge is somewhat lapsed and I don't have it installed on my PC. Have you tried executing your original query directly through the Access IDE? You might get some more meaningful information on the cause of the error.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
pmarfleet,
I have not tested that. But, is there a way of making it not database dependent? Because this project is aimed at running on a variety of database systems and i dont want to have to change the SQL every time, and yes, i know i could use stored procs to solve this, but is there another way.
Regards,
Gareth.
|
|
|
|
|
gareth111 wrote: But, is there a way of making it not database dependent?
AFAIK, string concatenation is pretty standard across different database providers. However there are likely to be subtle differences. For instance, in T-SQL you are required to cast non-string values to strings before attempting to concatenate that value with another string. Access is more forgiving, and I believe doesn't require explicit casting. If you want database independence, you should limit yourself to pure ANSI SQL in your queries and perform any data manipulation in your middle tier.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
hi
if u run this tsql command :
backup database northwind to disk='c:\nw.bak' with format,stats=10
it display percentage of compeletion of backing up your database in sql server output window, but i want to display it, in my app, how to do that ?
thanks
|
|
|
|
|
I doubt that this information is accessible. Instead, why not consider showing some sort of animated graphic? Something like the progress bar that Windows XP displays upon loading?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
thanks Paul Marfleet
but i think a way that show it in omy app.
however can u more explain of your suggestion ?
thanks
|
|
|
|
|
hdv212 wrote: but i think a way that show it in omy app.
I don't understand what this means.
hdv212 wrote: however can u more explain of your suggestion ?
Set the Style property of the ProgressBar to ProgressBarStyle.Marquee . Adjust the MarqueeAnimationSpeed property as required.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
|
Hi
I want to import the data available in .CSV file to a table(s)in sqlserver db from C#.net.
User has to choose the .csv file from the frontend and the data from that particular chosen file should be imported to database after the client side validation.
I hope for this , we need to read the specified file from the client machine and write it into the server machine,... i dont know how to handle permission issues and all.
Pls help me out how to do this scenario ASAP...
|
|
|
|
|
This is a common question and a quick Google[^] search provides you with plenty of information.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
im workingin windows service and i have to notify the user of specific messgae.showing message box is invalid in windows service.any solution.
regards
|
|
|
|
|
Use .NET remoting and have a normal application listening to your service and then pop up a message. NOT good to have a service showing messages!
|
|
|
|
|
Two queations about regular expressions:
(1) Is it possible to define "sub-patterns"?
I have a larger regex containing the same sub-pattern multiple times, e.g.
(?<idA>[a-zA-Z_][a-zA-Z_0-9]*)=(?<idB>[a-zA-Z_][a-zA-Z_0-9]*)
Is it possible to assign a sub-pattern to something (maybe \ö), so that I can use
(?<idA>\ö)=(?<idB>\ö)
?
(2) performance
Are there any general performance guidelines for regular expressions?
I would prefer to break down complex regexes into a few simpler ones sor readability.
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist
|
|
|
|
|
I have sometimes used MatchEvaluator delegate. A MatchEvaluator as an event handler that fires when an "OnMatch" event occures. Gives a little stucture to your regex.
And don't try that assignment with a subpattern
|
|
|
|