Click here to Skip to main content
15,886,110 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Arabic data is not displaying properly while exporting data to csv Pin
N a v a n e e t h27-Sep-09 2:08
N a v a n e e t h27-Sep-09 2:08 
GeneralRe: Arabic data is not displaying properly while exporting data to csv Pin
Khaja A. Imtiaz27-Sep-09 2:36
Khaja A. Imtiaz27-Sep-09 2:36 
AnswerRe: Arabic data is not displaying properly while exporting data to csv Pin
Abhishek Sur27-Sep-09 9:30
professionalAbhishek Sur27-Sep-09 9:30 
GeneralRe: Arabic data is not displaying properly while exporting data to csv Pin
Khaja A. Imtiaz27-Sep-09 21:27
Khaja A. Imtiaz27-Sep-09 21:27 
QuestionWhere is my database??? Pin
hasani200727-Sep-09 0:56
hasani200727-Sep-09 0:56 
AnswerRe: Where is my database??? Pin
Abhijit Jana27-Sep-09 1:01
professionalAbhijit Jana27-Sep-09 1:01 
QuestionLoad data into detailsview via C# Pin
_ASPAle_26-Sep-09 23:37
_ASPAle_26-Sep-09 23:37 
AnswerRe: Load data into detailsview via C# Pin
N a v a n e e t h26-Sep-09 23:58
N a v a n e e t h26-Sep-09 23:58 
You are clueless.

To fill a DataTable, you need to use DataAdapter and call Fill on it. Your code also got several issues including SQL injection attacks and improper resource cleanup. Here is a modified version of your code.
C#
public DataTable aggiorna()
{
     string IDModelloQ = Request.QueryString["IDModelloV"];
     string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
     string query = "SELECT * FROM Automobili WHERE IDModello = @IDModelloQ";
     DataTable table = new DataTable();
     using(SqlConnection connessione = new SqlConnection(connectionString))
     using(SqlCommand comando = new SqlCommand(query, connessione))
     {
         comando.Parameters.AddWithValue("@IDModelloQ", IDModelloQ);
         SqlDataAdapter adapter = new SqlDataAdapter();
         adapter.SelectCommand = comando;
         adapter.Fill(table);
     }
     return table;
}
Don't catch exceptions if you are not doing anything with that. Also
catch (Exception ex)
{
   throw ex;
}
is stupid. This will clear the stack-trace. To re-throw use just throw.


GeneralRe: Load data into detailsview via C# Pin
_ASPAle_27-Sep-09 0:10
_ASPAle_27-Sep-09 0:10 
GeneralRe: Load data into detailsview via C# Pin
Abhijit Jana27-Sep-09 0:15
professionalAbhijit Jana27-Sep-09 0:15 
GeneralRe: Load data into detailsview via C# Pin
_ASPAle_27-Sep-09 0:17
_ASPAle_27-Sep-09 0:17 
GeneralRe: Load data into detailsview via C# Pin
N a v a n e e t h27-Sep-09 0:19
N a v a n e e t h27-Sep-09 0:19 
GeneralRe: Load data into detailsview via C# Pin
_ASPAle_27-Sep-09 1:12
_ASPAle_27-Sep-09 1:12 
GeneralRe: Load data into detailsview via C# Pin
N a v a n e e t h27-Sep-09 1:41
N a v a n e e t h27-Sep-09 1:41 
AnswerRe: Load data into detailsview via C# Pin
khaleel the kiraak27-Sep-09 10:41
khaleel the kiraak27-Sep-09 10:41 
QuestionAbout ASP.NET application Hosting Pin
jahirhstu26-Sep-09 23:27
jahirhstu26-Sep-09 23:27 
AnswerRe: About ASP.NET application Hosting [modified] Pin
Abhishek Sur27-Sep-09 9:56
professionalAbhishek Sur27-Sep-09 9:56 
Questionabout publishing website [modified] Pin
hasani200726-Sep-09 23:08
hasani200726-Sep-09 23:08 
AnswerRe: about publishing website Pin
Abhijit Jana26-Sep-09 23:14
professionalAbhijit Jana26-Sep-09 23:14 
GeneralRe: about publishing website Pin
sashidhar26-Sep-09 23:19
sashidhar26-Sep-09 23:19 
AnswerRe: about publishing website Pin
sashidhar26-Sep-09 23:17
sashidhar26-Sep-09 23:17 
AnswerRe: about publishing website Pin
sashidhar26-Sep-09 23:20
sashidhar26-Sep-09 23:20 
GeneralRe: about publishing website Pin
hasani200727-Sep-09 0:52
hasani200727-Sep-09 0:52 
AnswerRe: about publishing website Pin
sashidhar27-Sep-09 1:55
sashidhar27-Sep-09 1:55 
Questionchange data value by one when I click on checkbox in gridview Pin
robotz26-Sep-09 22:26
robotz26-Sep-09 22:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.