Solved

SqlDataSource

Posted on 2011-09-21
3
376 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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!
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

861 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now