Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. database function

database function

Scheduled Pinned Locked Moved Database
csharpdatabase
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    manoj bhatt
    wrote on last edited by
    #1

    i have create a function in pubs data base create function show(@temp varchar(11)) returns table return(select *from author where au_id=@temp) now i wants to access this function from aspx page using c# please give me an applicable answer so that i will satisfied thanks regards (manoj bhatt)

    S 1 Reply Last reply
    0
    • M manoj bhatt

      i have create a function in pubs data base create function show(@temp varchar(11)) returns table return(select *from author where au_id=@temp) now i wants to access this function from aspx page using c# please give me an applicable answer so that i will satisfied thanks regards (manoj bhatt)

      S Offline
      S Offline
      SilimSayo
      wrote on last edited by
      #2

      String inputValue;
      String sqlText;
      SqlConnection connection;
      SqlCommand command;
      SqlDataReader dataReader;

      inputValue="123ABC";
      sqlText="SELECT dbo.show(" + inputValue +")";
      connection=new SqlConnection(" ...whatever your connection stuff is ");

      try
      {
      connection.Open();
      command=new SqlCommand(sqlText,connection);
      SqlDataReader dataReader = command.ExecuteReader();

      if(dataReader != null)
      {
      while(dataReader.Read())
      {
      --get values from dataReader
      }
      }
      }
      catch
      {

      }

      P 1 Reply Last reply
      0
      • S SilimSayo

        String inputValue;
        String sqlText;
        SqlConnection connection;
        SqlCommand command;
        SqlDataReader dataReader;

        inputValue="123ABC";
        sqlText="SELECT dbo.show(" + inputValue +")";
        connection=new SqlConnection(" ...whatever your connection stuff is ");

        try
        {
        connection.Open();
        command=new SqlCommand(sqlText,connection);
        SqlDataReader dataReader = command.ExecuteReader();

        if(dataReader != null)
        {
        while(dataReader.Read())
        {
        --get values from dataReader
        }
        }
        }
        catch
        {

        }

        P Offline
        P Offline
        Peter_in_2780
        wrote on last edited by
        #3

        oooh! shiny! SQL injection, here we come!!!!

        Software rusts. Simon Stephenson, ca 1994.

        S 1 Reply Last reply
        0
        • P Peter_in_2780

          oooh! shiny! SQL injection, here we come!!!!

          Software rusts. Simon Stephenson, ca 1994.

          S Offline
          S Offline
          SilimSayo
          wrote on last edited by
          #4

          I know.... personally I would have preferred a stored procedure.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups