as you can see from the SP, i need save in some variable because i have to create a dynamic SQL query who select with an "or" or "AND" from web form parametersthe problem is concatenate the SP parameter to my query
actually, this SP returns the string : "select * from...." and not the resultset!
I have a stored procedure that is close to working. It takes the values of a details view puts them into the respective table 'entity' then should also put the @@identity into 'entloan' and should put the LoanID which is in the query string of the page the detials view is loaded on, into the LoanID field of entLoan as well. Everything works except for getting the querystring value to pass to a insert variable on my stored procedure.
Stored Procedure
[Code]....
I do not have a LoanID Insert parameter set as it is not in entity table:
[Code]....
I have been playing around with different code in the backend but always get errors:
I have a web-report listing links to pdf documents. The pdf docs shows up in a new page based on frames in frames. I do not have control on the page showing pdfs.
In the web-report I want to let the user select multiple docs and then send them to print on the client.
i have placed a SqlDataSource component on my aspx page but while configuring the SqlDataSource in the "Test Query" Step I am passing the following parameters :But when i click ok it returns following error:This error occurs when i pass the string :
INFO, WARN, ERROR,
I have tried a lot of combinations but nothing works. It works only if i pass one of the three words in single quotes like this :'ERROR'Infact the INFO WARN and ERROR are the various levels available in the table. Each record can have only one level and in the sql query i am using IN("-----") to match the criteria, hope you understand.
I'm using a GridView control to edit data in a MySQL database.
I've created the C# code behind but I'm having trouble pulling back the parameter from a radiobutton control to populate an Int32 field in the database. I'm getting "Input string not in correct format"This is the particular bit (amongst a host of others of the same type) that is causing the problem:
I have written a code to insert emp details into database and i am also inserting local date(i,e system date) into to the table to know/have an idea at what date the employee inserted details. I have set date format add/MM/yyyy and its working well in my local system, but after uploading the site into server (the server is shared server) iam getting error and the error message is Failed to convert parameter value from a String to a DateTime.
Surprisingly, it is working well in server when i chaged the date format to MM/dd/yyyy, but now its not working in my local system and getting the same error.
I am not sure where my app is failing but most probably this is where it is failing.. I think lblExpID.Text is the culprit. Here's the relvant part of my code:
Dim lblExpID As Label For Each item In LSGrid.Rows lblExpID = item.FindControl("lblID") If txtExpGenFund.Text <> "" Then sqlArray(i) = ExpDetailsID & "," & (lblExpID.Text) & "," & MunID & "," & _ Val(txtExpGenFund.Text) & "," & Val(txtExpDetSpecialRevenue.Text) & "," & _ Val(txtExpDetCapitalProjects.Text) & "," & expTotal & "," & reportingYear & "," & "Test Comments" & "," & UserID End If
Can u help me identify why i am getting this error looking at the sp below:
PROCEDURE [dbo].[uspEXPENDITURE_DETAILS] ( @ExpDetailsID int=0 output, @ExpDet_ExpID int, @ExpDet_Municipality_ID nvarchar(50), @ExpDetGeneralFund money, @ExpDetSpecialRevenue money, @ExpDetCapitalProjects money, @ExpDetTotal money, @Exp_Reporting_Year varchar(10), @ExpComments varchar(max), @Contact_ID int ) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON;
delete from [dbo].[TBL_EXPENDITURE_DETAILS] where ExpDet_ExpID=@ExpDet_ExpID and ExpDet_Municipality_ID=@ExpDet_Municipality_ID and Exp_Reporting_Year=@Exp_Reporting_Year
If @ExpDetailsID >= 0 Begin INSERT INTO [dbo].[TBL_EXPENDITURE_DETAILS] ([ExpDet_ExpID] ,[ExpDet_Municipality_ID] ,[ExpDetGeneralFund] ,[ExpDetSpecialRevenue] ,[ExpDetCapitalProjects] ,[ExpDetTotal] ,[Exp_Reporting_Year] ,[ExpComments] ,[ExpDetCreatedBy] ,[ExpDetCreateDate]) VALUES (@ExpDet_ExpID, @ExpDet_Municipality_ID, @ExpDetGeneralFund, @ExpDetSpecialRevenue, @ExpDetCapitalProjects, @ExpDetTotal, @Exp_Reporting_Year, @ExpComments, @Contact_ID, GetDate() ) SET @ExpDetailsID = SCOPE_IDENTITY() return @ExpDetailsID end
I tried to pass a string value into a JavaScript function like below: <%= "'" + prop.property_description + "'") %>) But it does not seems to be the best option, is there a better way to do the above without concatenate the string values with "'"?
how to pass through a query string parameter of an assignment id and then checking and validating this as a number and displaying the information returned on screen. At present I have code which displays the information on screen but this is by entering in the assignment id and by triggering the button click event, I've shown the code for this below:
.aspx <div> <b>Current Assignment</b> <br /> <asp:TextBox runat="server" ID="txtAssignmentID"></asp:TextBox> <asp:Button runat="server" Text="Get Assignment" /> <br /> <b>Date Started:</b> <asp:Label runat="server" ID="lblAssignmentStart"></asp:Label> <br /> <b>Status:</b> <asp:Label runat="server"></asp:Label> <br /> <b>Current Achievement Level:</b> <asp:Label runat="server" ID="lblAssignmentLevel"></asp:Label> <br /> <b>Date Last Calculated:</b> <asp:Label runat="server" ID="lblAssignmentCalcDate"></asp:Label> <br /> </div> .cs protected void cmdGetAssignment_Click(object sender, EventArgs e) { //Check the assignmentID is an integer int AssignmentID = 0; try { AssignmentID = TypeConv.CInt(txtAssignmentID.Text); } catch { } if (AssignmenttID > 0) { //Create new TCAAssignment object by passing the ID TCA Assignment Current Assignment = abc.TCA Assignment (AssignmentID); lblAssignmentStart.Text = Current Assignment.dDateCreated.ToString(); lblAssignmentStatus.Text = CurrentAssignment.rTCAAssignmentStatus.dDescription; if (!CurrentAssignment.dTCAAchievementLevel.IsNull) { lblAssignmentLevel.Text = CurrentAssignment.rTCAAchievementLevel.dDescription; } lblAssignmentCalcDate.Text = CurrentAssignment.dAchievementDate.ToString(); } }
Code example passing through a query string parameter of an assignment id would be great.
I have a dropdown list that won't populate data values from database using sql datasource. When i use the code behind, i was able to populate the data to the dropdown list. I dont know how to pass the Query String Parameter using code behind since i am new in asp.net. This is the code behind:
Imports System.Data.SqlClient Partial Class PhotoAlbum Inherits System.Web.UI.Page Dim oConn As New SqlConnection("Data Source=.SQLEXPRESS;" & _ "AttachDbFilename=|DataDirectory|ASPNETDB.MDF;" & _ "Integrated Security=True;User Instance=True") Dim oCmd As New SqlCommand() Dim oDR As SqlDataReader Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load oConn.Open() oCmd.CommandText = "SELECT [CategoryID], [Name] FROM Categories ORDER BY [Name]" oCmd.Connection = oConn oDR = oCmd.ExecuteReader() Me.categories.DataSource = oDR Me.categories.DataTextField = "Name" Me.categories.DataValueField = "CategoryID" Me.categories.DataBind() oDR.Close() oConn.Close() End Sub End Class
I will like to include the following information from sqlDatasource to the codebehind:
SelectCommand="SELECT [CategoryID], [Name] FROM [Categories] WHERE ([UserId] = @UserId) ORDER BY [Name]"> <SelectParameters> <asp:QueryStringParameter Name="UserId" QueryStringField="ID"/>
As you can see from the code behind, i was able to add :
"SELECT [CategoryID], [Name] FROM Categories ORDER BY [Name]".
But i will like to add all of this:
SelectCommand="SELECT [CategoryID], [Name] FROM [Categories] WHERE ([UserId] = @UserId) ORDER BY [Name]"> <SelectParameters>
i have a function which returns a value from a query string parameter, i use it in more than 10 places in the webapp thus i have to rewrite the code every time, again and again.so to make it short, is there any way i can embed the code somewhere and keep referring to it through out my app?
When running our web application the following message appears:
Failed to convert parameter value string to decimal. We believe that the problem might be with the sequence which generates the user_id. The user_id should be the output after successful insert of record. The stored procedure works well from within the DB and Visual Studio. Our DB version: 11gR1 on Windows.The web form has a button event with this c#-code:
I have data in ParamList (from SQL reporting services database)which I want to display in a GridView. as ParameterName and VAlue. I am able to retrieve the parameters but can't figure out how to read them into ArrayList (or whatever method you coud suggest) and then bind to grid. Final grid should be like this-
ParameterName ParameterValue Year 1011 Number1 0011 Number2 0101 Number3 0201
Here is the code I'm trying to figure out-
Dim intCount As Integer Dim strparam As String Dim strparam1 As String Dim varResult As Object Dim ParamList as string ParamList = "Year=1011&Number1=0011&Number2=0101&Number3=0201" varResult = Split(ParamList, "&") Dim arrList As New ArrayList() 'loop through array and retrieve parms For intCount = 0 To UBound(varResult) varParam = Split(varResult(intCount), "=") strparam1 = UCase(varParam(0)) strparam = varParam(1) arrList = ??? Next 'and then display tsi data into a grid. GridViewParams.DataSource = arrList