Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SqlDataSource

Posted on 2011-09-21
3
Medium Priority
?
408 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 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

721 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