hi, I'm using the following code to add a textbox and a column in a DB....................... SqlConnection objConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);SqlCommand objCmd = new SqlCommand("UPDATE Cash SET Cash_Balance=Cash_Balance+@myValue", objConn);objCmd.Parameters.AddWithValue("@myValue", txtAMST.Text);objConn.Open();objCmd.ExecuteNonQuery();objConn.Close(); I have it almost working, except for 1 issue. The value in the DB column is 400. The value in the textbox is, for example, 200. When the code executes, instead of putting in 600 in the DB column, it puts in 400200. Any idea as to what i'm leaving out?
I need to add a textbox in the report which would display the total number of rows in the report.I need to do this in reports which have either tabular layout or a matrix layout . Thanks in advance
I was wondering if anyone has figured out a way to add text up in the parameter section of a report. I wanted to add something like: "Please use this option when you want a full result set" or something of the sort.
I'll go to a dataset, open up the query designer, add a new parameter, then refresh the fields, but the parameter won't be added as a report parameter. If I go to the dataset properties under the list of parameters, the value in the dropdown will be blank. However, sometimes this will automatically add.
Is this a bug in Visual Studio? How do I get around this?
In my report,I have multivalue parameter for this parameter the Available values are from the Dataset.Suppose the dataset contains Names like this: 'AL - Alabama Center (Tuscaloosa)', 'AL - Regional Control Center (Birmingham)', 'AR - Arkansas & Rock)', 'Arizona Department of Health' But my problem is the Multivalue parameter TextBox is of fixed size.Now i want the size of the text box to the size of the name which is of length long in the Name. Whether it is possible or not. How to achieve this.
I have a details view with several parameters set up in my asp.net 2.0 code, I want to add a parameter before the sql parameter is executed. I need to use the find control of the details view because I am using items/edit item templates in my details view control. I tried this(see below) as well as the detailsview item command event args to no avail. It doesn't see the other parameters that have already been declared in my asp.net code. I don't want to have to declare all my varibles that are already in my asp.net code. I just want to add another parameter. Sub InsertNew(ByVal sender As Object, ByVal e As DetailsViewInsertEventArgs) _ Handles dvEvents.ItemInserting Dim dvr As DetailsViewRow For Each dvr In dvEvents.Rows Dim CatIDup As Integer = CType(dvr.FindControl("ddlCat"), DropDownList).SelectedValue sdsevents.InsertParameters.Add("evCatID", CatIDup)sdsevents.Insert()
Is there any possibility to add global parameters to the reports? I'd like to add my parameter that would be avilable on the all reports on the reports server and use it in actions.
I want to add a parameter to the following SQL-sequence. ActivityGroup is the table and I want to select the current activityGroupID in place of XXXXX. Do I need to put this in a stored procedure?
select * from ActivityGroup where cpgActivityGroupID = XXXXX and cgpRegistredFrom > getDate() and cgpRegistredTo < getDate()";
Each time we add a new parameter to a subreport and we link the main report's fields to be the value's to the parameters for the subreport, we get an error message stating that the parameter for the subreport has not been specified. If we physically REBOOT the computer and then reload the project, the error seems to clear up.
Is this a bug in Reporting Services or is there some other explaination.
I have 3 specific where searches in where command I want to add a defined text to each specific where query if that makes sense. highlighted in red, how do I do this? going to add status after and then do pivot table afterwards.
I have a report parameter textbox in my SSRS report which has the parameter properties as "allow null value" and "allow blank value" checked.
How I can ensure that when the value is entered in textbox, it should accept any character ie. The SQL code I should write so that all the characters inputted via the report parameter are accepted.
Hi,I'm trying to create a page where a user can search the database according to some criteria and get back the result in the form of a GridView. Also, the user has the option of saving the criteria to another table in the database by assigning it a name so that it can be retrieved easily in the future.I have the search and display part working, however, saving the criteria to the database is giving problems for some reason.Given below is my stored procedure to add the info to the db. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[AddToReport] (@ReportName varchar(100), @ProjID varchar(300), @DeptCode varchar(20), @ProjType varchar(20), @ProjectTitle varchar(300), @ProjectManagerID int, @DateRequested datetime, @DueDate datetime, @ProjectStatusID int)
AS SET NOCOUNT ON DECLARE @Dept varchar(50) DECLARE @err int
BEGIN TRANSACTION
IF @ReportName IS NULL BEGIN RETURN -1 END ELSE BEGIN IF @DeptCode IS NOT NULL BEGIN SET @Dept = REPLACE(CONVERT(char,@DeptCode),'.','') END SET @err = @@ERROR
INSERT INTO dbo.tbl_Report (ReportName, ProjID, DeptCode, ProjType, ProjectTitle, ProjectManagerID, DateRequested, DueDate, ProjectStatusID) VALUES (@ReportName, @ProjID, @Dept, @ProjType, @ProjectTitle, @ProjectManagerID, @DateRequested, @DueDate, @ProjectStatusID); IF @err<>0 BEGIN ROLLBACK TRANSACTION RETURN @err END END COMMIT TRANSACTION Given below is the relevant codebehind. This is how the values are initialized: Dim newManager As New ListItem newManager.Text = "Choose a Manager" newManager.Value = 0 projectManagerDDL.Items.Add(newManager)
Dim newDept As New ListItem newDept.Text = "Choose a Department" newDept.Value = "" deptCodeDDL.Items.Add(newDept)
Dim newID As New ListItem newID.Text = "Choose a Project" newID.Value = "" projIDDDL.Items.Add(newID)
Dim newStatus As New ListItem newStatus.Text = "Choose a Status" newStatus.Value = 0 projectStatusDDL.Items.Add(newStatus)
Dim newDateRequestedMonth As New ListItem newDateRequestedMonth.Text = "Month" newDateRequestedMonth.Value = 0 dateRequestedMonthDDL.Items.Add(newDateRequestedMonth)
Dim newDateRequestedDay As New ListItem newDateRequestedDay.Text = "Day" newDateRequestedDay.Value = 0 dateRequestedDayDDL.Items.Add(newDateRequestedDay)
Dim newDateRequestedYear As New ListItem newDateRequestedYear.Text = "Year" newDateRequestedYear.Value = 0 dateRequestedYearDDL.Items.Add(newDateRequestedYear)
Dim newDueDateMonth As New ListItem newDueDateMonth.Text = "Month" newDueDateMonth.Value = 0 dueDateMonthDDL.Items.Add(newDueDateMonth)
Dim newDueDateDay As New ListItem newDueDateDay.Text = "Day" newDueDateDay.Value = 0 dueDateDayDDL.Items.Add(newDueDateDay)
Dim newDueDateYear As New ListItem newDueDateYear.Text = "Year" newDueDateYear.Value = 0 dueDateYearDDL.Items.Add(newDueDateYear) This is the submit code: Protected Sub saveButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim connString As String Dim con As SqlConnection
Dim cmd As SqlCommand = New SqlCommand() cmd.Connection = con
If (([String].IsNullOrEmpty(reportNameTextBox.Text) = False) Or reportNameTextBox.Text <> "Enter Report Name") Then cmd.Parameters.Add("ReportName", SqlDbType.VarChar, 300).Value = reportNameTextBox.Text End If
If ([String].IsNullOrEmpty(projIDDDL.SelectedItem.Value)) = False Then cmd.Parameters.Add("ProjID", SqlDbType.VarChar, 30).Value = projIDDDL.SelectedItem.Value End If
If ([String].IsNullOrEmpty(deptCodeDDL.SelectedItem.Value)) = False Then cmd.Parameters.Add("DeptCode", SqlDbType.VarChar, 20).Value = deptCodeDDL.SelectedItem.Value End If
If (typeRBL.SelectedItem.Value <> "All") Then cmd.Parameters.Add("ProjType", SqlDbType.VarChar, 20).Value = typeRBL.SelectedItem.Value End If
If ([String].IsNullOrEmpty(projectTitleTextBox.Text)) = False Then cmd.Parameters.Add("ProjectTitle", SqlDbType.VarChar, 300).Value = projectTitleTextBox.Text End If
If CInt(projectManagerDDL.SelectedItem.Value) <> 0 Then cmd.Parameters.Add("ProjectManagerID", SqlDbType.Int).Value = CInt(projectManagerDDL.SelectedItem.Value) End If
If (dateRequestedDayDDL.SelectedItem.Value = 0 Or dateRequestedMonthDDL.SelectedItem.Value = 0 Or dateRequestedYearDDL.SelectedItem.Value = 0) Then Dim dateRequested As New DateTime dateRequested = Nothing Else Dim dateRequested As New DateTime(dateRequestedYearDDL.SelectedValue, dateRequestedMonthDDL.SelectedValue, dateRequestedDayDDL.SelectedValue) If (dateRequested) <> Nothing Then cmd.Parameters.Add("DateRequested", SqlDbType.DateTime).Value = dateRequested End If End If
If (dueDateDayDDL.SelectedItem.Value = 0 Or dueDateMonthDDL.SelectedItem.Value = 0 Or dueDateYearDDL.SelectedItem.Value = 0) Then Dim dueDate As New DateTime dueDate = Nothing Else Dim dueDate As New DateTime(dueDateYearDDL.SelectedValue, dueDateMonthDDL.SelectedValue, dueDateDayDDL.SelectedValue) If (dueDate) <> Nothing Then cmd.Parameters.Add("DueDate", SqlDbType.DateTime).Value = dueDate End If End If
If (projectStatusDDL.SelectedItem.Value) <> 0 Then cmd.Parameters.Add("ProjectStatusID", SqlDbType.Int).Value = CInt(projectStatusDDL.SelectedItem.Value) End If
Try con.Open() cmd.ExecuteNonQuery() Response.Write("Report Saved") Catch ex As Exception Response.Write(ex) Finally con.Close() con.Dispose()
End Try
Catch ex As ApplicationException Response.Write("Could not load the database") End Try
End Sub The only absolute requirement when saving to the table is the ReportName. All the other criteria can be NULL. If I don't select and values and try to save the values, I get an error:System.Data.SqlClient.SqlException: Procedure or function 'AddToReport' expects parameter '@ProjID', which was not supplied. at System.Data.SqlClient.SqlConnection.OnError... etc If I choose the ProjID (thus giving it a value), I get the following error:System.Data.SqlClient.SqlException: Procedure or function 'AddToReport' expects parameter '@DeptCode', which was not supplied. at System.Data.SqlClient.SqlConnection.OnError... etc and so forth. I'm guessing it's a problem of NULLs somewhere, but I'm not sure. Thanks.
I have a parameterized report based on a MDX query (so no drag and drop of filters and fields). Now i have to ad a parameter. So i open the query parameter dialog box and i ad my parameter. when i click ok , my dataset becomes empty , resulting in an error on my report saying that the fields on the report cannot by found and should be in the scope of the dataset.
Has anyone experienced this problem before, or am i forgetting something here?
First of all; My Oracle publication works fine when I don't explicit specify the shema_option parameter for the articles I'm adding to the publication. The reason why I then want to explicit specify the parameter is as following.
I'm developing a replication solution to get data from our production server (Oracle) to our Data Warehouse (SQL Server). The SQL Server (and the Data Warehouse code) uses the SQL_Latin1_General_CP1_CI_AS collation. When I don't explicit specify the schema_option, the nvarchar columns of the replicated tables are created using the SQL_Latin1_General_CP1_CS_AS collation and this results in some comparison errors, when for instance a select statement is trying to compare two nvarchar strings using different collations.
I've tried to specify the schema_option parameter as "@schema_option = 0x80" (Replicates primary key constraints.) to avoid the use of the SQL_Latin1_General_CP1_CS_AS collation when creating the destination tables - I'm not sure it's enough? No matter what, I'm getting an error when I'm doing it (see below).
Message 2006-07-13 12:00:15.529 Applied script 'ITEMTRANSLATION_2.sch' 2006-07-13 12:00:15.544 Bulk copying data into table 'ITEMTRANSLATION' 2006-07-13 12:00:15.544 Agent message code 20037. The process could not bulk copy into table '"ITEMTRANSLATION"'. 2006-07-13 12:00:15.591 Category:NULL Source: Microsoft SQL Native Client Number: 208 Message: Invalid object name 'ITEMTRANSLATION'. 2006-07-13 12:00:15.591 Category:NULL Source: Number: 20253
The questions are now whether I actually have a schema_option alternative for Oracle Publishing? If so, what is the solution, and eventually how can I avoid the error stated above?
If I'm not able to avoid the article columns getting created with the "wrong" collation, is there then any other obviously solution to the problem?
Hi! I dont know if i will explain this correctly, but my problem is with reporting service. I'm supposed to Sum value in one textbox and than that sum use it in sum in other textbox.
Something like this: Sum(Fields!Abc.Value/(Fields!dfg.Value+Sum(Fields!abc.Value)),"matrix1_RowGroup1")*100 I get error msg 'The Value expression for the textbox 'textbox49' contains an aggregate function (or RunningValue or RowNumber functions) in the argument to another aggregate function (or RunningValue). Aggregate functions cannot be nested inside other aggregate functions.'
Something like this wont work either Sum(Fields!abc.Value/ReportItems("textbox56").Value)*100 Error The Value expression for the textbox 'textbox55' uses an aggregate function on a report item. Aggregate functions can be used only on report items contained in page headers and footers.
So, pls help if you know how to reference textbox in other in body of report. Thx.
If I have a Select statement like this in my C# code: Select * From foods Where foodgroup In (@foodgroup) And I want @foodgroup to have these values ... "meat", "dairy", fruit", what is the correct way to add the parameter? I tried meat, dairy, fruit 'meat', 'dairy', 'fruit' but neither worked. Is this possible?
Is there any way or option to get the all columns of dataset added to table when we add a table in data region. It will take lot of time to add one by one and also there are chances to add one column ore than once.
What is the syntax for adding a column where you are adding a year to a date in a date format? For example adding a column displaying a year after the participation date in date format?
I have several textbox on my report and I would like to remove line if blank.
texbox1 textbox2 <--- use Expression in order to display it. textbox3
------------------------------------------------------------------------------ Current Display :
sergio myers
<-------- insert a blank line donna summer
_____________________________________________ The Desire Result that I would like to have : sergio myers donna summer _____________________________________________ I would like to remove the middle line if blank so it can be display like this : sergio myers donna summer
Does anybody knows how to accomplish this in Reporting Services. Foxpro uses "Remove line if blank" and 'Print only when expression is true'
Hey I got a SQL DB with three tables, where two of the collums of the main table gets its data from two other tables, ok? Now, on one page, called "search" the user should be able to search in the DB, and on another page the user should be able to register some keywords, my question is how can the user register several keywords in the same textbox, using perhaps a ; as a separator between the words? I hope you understand what I mean..
Hello How do u update the datafield of a row using buttonClick in vb? I have a details view whereby it will display the username and timeleft once log in. currently the datafield, timeleft on one user in the database is null. I'm using sqldatasource. Once log in, it will direct to this page where the user enters a code on the textbox and click the enter button. This will cause an update on the user's timeleft. But the code must not be entered to the database. For eg. If code = 1111 then 'update timeleft = 60 The timeleft is in minutes. 60 will be stored as double in the user's row in the database. How do i do this? Please help asap. Thanks! :)
HelloI have a problem when I want to update my textbox, I have a textbox called Textbox1, when I Insert data from it to database it is working well, even when I Update it WITHOUT SELECT field from database it is working well again,but when I Select [pagename] from database then want to Update it it is not working, nothing happend and in debuging the textbox doesnt have any value. what shoud i do? the value become null? Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Label1.Text = Request("Id").ToString() Dim conname As String = ConfigurationManager.ConnectionStrings("IPbrandConnectionString").ConnectionString() Dim con As New SqlConnection(conname) Dim sql As String = "SELECT [Id], [pagename] FROM [content] WHERE ([Id] = @Id)" Dim cmd As New SqlCommand(sql, con) cmd.Parameters.Add(New SqlParameter("@Id", SqlDbType.Int, 32)) cmd.Parameters("@Id").Value = Label1.Text.ToString() con.Open() Dim reader As SqlDataReader = cmd.ExecuteReader() Do While reader.Read() TextBox1.Text = reader("pagename") Loop reader.Close() con.Close() End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim conname1 As String = ConfigurationManager.ConnectionStrings("IPbrandConnectionString").ConnectionString() Dim con1 As New SqlConnection(conname1) Dim sql1 As String = "UPDATE [content] SET [pagename] = @pagename WHERE [Id] = @Id " Dim cmd1 As New SqlCommand(sql1, con1) cmd1.Parameters.Add(New SqlParameter("@Id", SqlDbType.Int, 32)) cmd1.Parameters("@Id").Value = Label1.Text.ToString() cmd1.Parameters.Add(New SqlParameter("@pagename", SqlDbType.VarChar, 50)) cmd1.Parameters("@pagename").Value = TextBox1.Text.ToString() cmd1.UpdatedRowSource = UpdateRowSource.OutputParameters Try con1.Open() cmd1.ExecuteNonQuery() Catch err As SqlException Throw New ApplicationException("Data error.") Finally con1.Close() End Try Server.Transfer("main.aspx")
I am working with a Detailsview. I am displaying information from a number of different tables, and so when I configure the datasource I have to specify a custom sql statement. I can get it to display the right columns, but I cannot seem to be able to use a where statement. I am wanting to display the info in the Detailsview based on what is entered into a textbox, but I get an error when I try to add in the where statement. Can someone tell me what I am missing here? Thanks
Hey guys, I am trying to create a report which features a lot of textboxes side by side, but I have the problem that even though they are the same size when the textboxes are placed side by side or above or below another textbox and then the preview tab is selected they often look different for example they may not be aligned correctly or the borders look thicker in different textboxes.
I'm trying to assign multiple values to a textbox and I'm receiving an error. The error says, "The value expression for the textbox AcctName contains an error." The first value is account number and the second value is account name. An example follows:
1234 - SPC Travel Agency
My expression for the textbox contains the following: