Hello all,
I've a C# application connecting to a SQL Server 2005 DataBase and it all works well in development ambient. I'm developing with Visual Studio 2005 and i can connect to the DataBase with no problem.
The problem is: when i try to run the application directly from the exe file, every time there is a connection to the same database (and with exactly the same connection string) that i connected with no problem...
User Profile
Collapse
-
It's solved, and it was obvious: a loop from end to beginning.
Joaquim -
How to delete a group of rows from a DatTable
Hello,
I need to delete a group of rows from a DataTable based on a condition. Something like:
...Code:string CRefeicao = "01", CFamiliaPrato = "02"; foreach (DataRow LinhaDetalhe in Detalhe.Rows) { string Crefeicao2 = LinhaDetalhe["CRefeicao"].ToString(); string CFAmiliaPrato2 = LinhaDetalhe["CFamiliaPrato"].ToString(); if (CRefeicao -
Thank you Plater.
Meanwile i solved my problem: it was related with a DataTable.Reset () i do between the 1st and 2nd call to the event.
I replaced the reset() with a clear() and now the DataGridView behaves as it should.
I don't understand, though, why the DataGrid was so closely bind to the DataTable that, with no DataBind in code, it reacted to its reset, but, when i populated the Table again, it did not react...Leave a comment:
-
No i'm not adding the columns each time, they're added automaticaly by VS2005 in the Class.Designer. cs file, and i do not touch them anymore.
And there is no columns with the same name, where did you get that idea?
JoaquimLeave a comment:
-
Thank You Plater:
I didn't mention it, for readability reasons, but the two columns are comboboxes, so i need to set the datasource for each one of the comboboxes and the auto-generate behaviour does not do what i want, because it generates TextBox columns.
About removing columns: is that necessary? Maybe that's the reason for the behaviour, but thinking again: no, because in the 2nd time i run the code i see that the...Leave a comment:
-
DataGridView Behaviour
Helo,
I got this problem with a c# DataGridView in VS2005:
The DataGridView has 2 columns: colArtigoGeneri co, colArtigoFinal; and this columns are populated with data from 2 columns from a DataTable: "Detalhes".
1st i populate the DataGrid with a Datatable using this code:
string select = "SELECT a.CArtigoGeneri co, a.CArtigoFinal " +
"FROM ArtigosGenerico s... -
-
MSDE Database
How can i see the content (tables) of a mdf database file?
When i open Microsoft Sql Server Management Studio Express i can not see the database i want (c:\inetpub\www root\app_data\a spnetdb.mdf in this case).
This tool (MS SQL Server Management Studio) is not the right tool for opening these files? Or i have to do something to add this particular file to the session?
When i try to open this file with it... -
Selecting the respective datagrid row when i find a record
Hello,
I'm new to c#, and i am trying to implement the following behaviour to a DataGrid:
When i locate a record in one DataTable i want to select and show the respective grid row in the DataGrid.
The DataGrid.DataSo urce is a DataSet called 'MinhaTabela'.
The DataGrid.DataMe mber is a DataTable from that DataSet, called 'Nomes'.
When i find one record on that DataTable i want that... -
Sorry to everyone,
You don't have to answer, it was a rookie error: i forgot the '[]' when creating the object 'chave'.
Thank you,
Joaquim...Leave a comment:
-
Error in finding a value with a composed key
Hello,
I'm new to C#, and i need help with the following problem:
I have a DataTable called 'Nomes', part of a DataSet with various datatables.
I am searching a record (that i know it exists) in that DataTable. I need two fields from that DataTable to compose the key.
Example: i'm looking for the record where field 'Codigo' = '000100' and field 'CPostal' = '3000-001'.
...Code:// Defining
No activity results to display
Show More
Leave a comment: