Solved

SqlDataSource

Posted on 2011-09-21
3
401 Views
Last Modified: 2012-06-27
Hi,
    I am trying to implement SqlDataSource Passing Parameter Values at Code Behind. The SqlDataSource contain 'Stored Procedure' to Update the Table, and it have two parameters . Now my Requirement is SqlDataSource does not added to any data control is it possible Passing Parameter values and Calling this SqlDataSource at Code Behind..?
0
Comment
Question by:CPSRI
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Accepted Solution

by:
Eduardo Goicovich earned 500 total points
ID: 36574055
dsrc = New SqlDataSource()
dsrc.ConnectionString = ConnectionString
dsrc.InsertCommand = "SPNAME"
dsrc.InsertCommandType = SqlDataSourceCommandType.StoredProcedure
Dim parms As ParameterCollection = dsrc.InsertParameters
Dim newid As Integer
AddParameter(parms, "PARAM1", TypeCode.Int32, ParameterDirection.Input, 0, album.ArtistID)
AddParameter(parms, "PARAM2", TypeCode.String, ParameterDirection.Input, 0, album.Title)
parms.Add(p)
Try
   Dim rv As Integer = dsrc.Insert()
Catch ex As Exception
   Return -1
End Try
0
 
LVL 41

Expert Comment

by:guru_sami
ID: 36575833
If your SqlDataSource is not bound to any Controls, any specific to use it?
You might want to look using SqlConnection/SqlCommand classes.
0
 

Author Closing Comment

by:CPSRI
ID: 36578310
Thank You..
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question