Click here to Skip to main content
15,889,403 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Datagrid Pin
sudhanvag25-Jan-09 7:48
sudhanvag25-Jan-09 7:48 
GeneralReporting Pin
Brady Kelly22-Jan-09 5:44
Brady Kelly22-Jan-09 5:44 
GeneralRe: Reporting Pin
ToddHileHoffer22-Jan-09 6:54
ToddHileHoffer22-Jan-09 6:54 
GeneralRe: Reporting Pin
Brady Kelly22-Jan-09 7:12
Brady Kelly22-Jan-09 7:12 
GeneralRe: Reporting Pin
VenkatFor.NET22-Jan-09 20:25
VenkatFor.NET22-Jan-09 20:25 
GeneralSQL Reporting Services Pin
David Mujica25-Jan-09 2:04
David Mujica25-Jan-09 2:04 
GeneralRe: SQL Reporting Services Pin
Brady Kelly25-Jan-09 2:53
Brady Kelly25-Jan-09 2:53 
Question[newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
jon-8022-Jan-09 4:45
professionaljon-8022-Jan-09 4:45 
I'm trying to execute a simple command and pass it to a text box, however it does not seem to work.

Any idea why?

Confused | :confused:

//Insert to database and display task reference
            try
            {
                conAppDB.Open();
                // Retrieve latest taskID from database and display it.
                //:TODO  Update design, because of possible concurrent users.
                string getTaskRef = @"SELECT MAX([taskID_PK]) FROM [teamwiki].[dbo].[task];";  
                SqlCommand getTaskRefSQL = new SqlCommand(getTaskRef, conAppDB);
                if (getTaskRefSQL != null)
                {
                    txtTaskRef.Text = (string)getTaskRefSQL.ExecuteScalar(); 

// Note: Although the code passes through here, the value of getTaskRefSQL is null, is this a bug?

                }

            }
            catch (InvalidCastException)
            { 
                //Occurs when database is empty.
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally {
                conAppDB.Close();
            }


Environment
.NET framework 2.0.50727 SP1
Visual Studio 2005 Team Edition

Jon

AnswerRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
Ashfield22-Jan-09 4:51
Ashfield22-Jan-09 4:51 
GeneralRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
jon-8022-Jan-09 4:58
professionaljon-8022-Jan-09 4:58 
AnswerRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
Colin Angus Mackay22-Jan-09 4:57
Colin Angus Mackay22-Jan-09 4:57 
GeneralRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
jon-8022-Jan-09 5:11
professionaljon-8022-Jan-09 5:11 
GeneralRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
Colin Angus Mackay22-Jan-09 5:32
Colin Angus Mackay22-Jan-09 5:32 
GeneralRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
jon-8022-Jan-09 20:50
professionaljon-8022-Jan-09 20:50 
AnswerRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
Colin Angus Mackay22-Jan-09 5:08
Colin Angus Mackay22-Jan-09 5:08 
GeneralRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
jon-8022-Jan-09 7:12
professionaljon-8022-Jan-09 7:12 
QuestionDelete Value from Cookie Pin
Abdullah S. Abdelhay22-Jan-09 4:43
Abdullah S. Abdelhay22-Jan-09 4:43 
AnswerRe: Delete Value from Cookie Pin
Jon Rista22-Jan-09 6:32
Jon Rista22-Jan-09 6:32 
GeneralRe: Delete Value from Cookie Pin
rama charan22-Jan-09 17:47
rama charan22-Jan-09 17:47 
AnswerRe: Delete Value from Cookie Pin
Rajdev Ramasamy26-Jan-09 22:28
Rajdev Ramasamy26-Jan-09 22:28 
Questionworking with excel files version independantly in asp.net2.0 Pin
Nitin K22-Jan-09 3:47
Nitin K22-Jan-09 3:47 
AnswerRe: working with excel files version independantly in asp.net2.0 Pin
Rutvik Dave22-Jan-09 3:56
professionalRutvik Dave22-Jan-09 3:56 
QuestionASP.NET MVC Pin
Brendan Vogt22-Jan-09 2:31
Brendan Vogt22-Jan-09 2:31 
AnswerRe: ASP.NET MVC Pin
ToddHileHoffer22-Jan-09 2:53
ToddHileHoffer22-Jan-09 2:53 
AnswerRe: ASP.NET MVC Pin
Not Active22-Jan-09 3:24
mentorNot Active22-Jan-09 3:24 

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.