locked
Take one cell's value and convert it into a string for display in a label. RRS feed

  • Question

  • Hi,

    I know this is probably simple but...

    I want to select one value from a cell in our MSSQL database, and turn it into a string and put it in a label on our asp.net website.

    myEmailTemplateCommand = New SqlDataAdapter("SELECT ClientEmailSrc FROM EmailTemplates WHERE LeadType='contact';", myEmailTemplateConnection)

    I have the codebehind for the selection of the one cell.

    I'm having trouble figuring out how to put THAT value into a label or textbox on the page.

    Thanks in advance...

    David

    Friday, August 14, 2020 8:15 PM

All replies

  • What is the datatype of ClientEmailSrc?

    Have you tried "...SELECT CONVERT(varchar(255), ClientEmailSrc) as ClientEmailSrc FROM..."?
    Friday, August 14, 2020 8:57 PM
  • I'm having trouble figuring out how to put THAT value into a label or textbox on the page.

    That has nothing to do with MS SQL Server/Transact-SQL, the topic of this forum; better post your question to a more related forum.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Saturday, August 15, 2020 8:35 AM
  • Hi

    It is a part of ado.net .Please display more code .Your code looks good.

    Thanks and regards

    Saturday, August 15, 2020 9:58 AM
  • Hi Altabear,

    Conversion data type can use cast or convert,they can convert an expression of one data type to another,please refer to  CAST and CONVERT (Transact-SQL),

    Besides,Laxmidhar sahoo said your issue is related to ado.net. I suggest you open a thread in ado.net forums(https://www.developerfusion.com/t/ado.net/forum/), People there will help you more effectively.
    Hope this could help you.

    Best Regards 
    Echo   


    ""SQL Server related"" forum will be migrated to a new home on Microsoft Q&A SQL Server!
    We invite you to post new questions in the "SQL Server related" forum’s new home on Microsoft Q&A SQL Server !
    For more information, please refer to the sticky post.





    • Edited by Echo Liuz Monday, August 17, 2020 5:56 AM
    Monday, August 17, 2020 5:38 AM
  • Hi Altabear,


    Has your problem been solved? If it is solved, please mark the point that you 
    think is correct as an answer. This can help others who encounter similar problems.

    Best Regards 
    Echo   


    ""SQL Server related"" forum will be migrated to a new home on Microsoft Q&A SQL Server!
    We invite you to post new questions in the "SQL Server related" forum’s new home on Microsoft Q&A SQL Server !
    For more information, please refer to the sticky post.

    Tuesday, August 18, 2020 5:57 AM