SQLDataSource

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • suganya
    New Member
    • Dec 2006
    • 39

    SQLDataSource

    Hi

    Instead of connecting SQLDataSource to the GridView directly & giving query in it. How can I use the SQLDataSource & its query in Codebehind.
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    So you want to do things the old fashioned way... One way is to create a connection and sql text command. Execute the command using a reader, creating a datatable or dataset and then bind to the grid. HTH.

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      Originally posted by kenobewan
      So you want to do things the old fashioned way... One way is to create a connection and sql text command. Execute the command using a reader, creating a datatable or dataset and then bind to the grid. HTH.
      An even easier way IMHO is using a DataAdapter. If you make a SqlDataAdapter and an empty DataSet, you can use the adapter.Fill(ds ,"tableName" ) method.

      Comment

      Working...