Hello everyone, i have the parameter in my stored procedure that i am using as a sqldatasource.
Now in one of the events, i need to assign a value to the parameter. How can i do that? Microsoft is changing the syntax so often, all solutions i found on this forum just don't work anymore, like: SqlDataSource1.SelectParameters["@CompareInteger"].value= "1" OR SqlDataSource1.SelectParameters["@CompareInteger"].DefaultValue= "1"
I guess the SelectParameter - became 'ReadOnly'..But how to assign value to a parameter now?!? Thanks for any help
Hi, I'm trying to update a sqlserver database through vb.net in an asp.net 2.0 project. I'm using a sqldatasource and am trying to code an update parameter with a session variable. code snippet: <UpdateParameters><asp:Parameter Name="hrs_credited" /> <asp:Parameter Name="updater_id" DefaultValue="<%$ Session("User_ID")%>" Type="Int32"/> <asp:Parameter Name="activity_id" /> <asp:Parameter Name="attendee_id" /></UpdateParameters> The error message that I receive is: Error 2 Literal content ('<asp:Parameter Name="updater_id" DefaultValue="" Type="Int32"/>') is not allowed within a 'System.Web.UI.WebControls.ParameterCollection'. C:DevelopmentCMEdataentryattendance.aspx 29 Does anyone have an idea how to assign the session var value to the parameter? Thanks!
Hello, I'm needing to pass a variable length number of values to a select statement so I can populate a result list with items related to all the checkboxlist items that were selected by the user. for example, the user checks products x, y and z, then hits submit, and then they see a list of all the tests they need to run for each product. I found a UDF that parses a comma delimited string and puts the values into a table. I learned how to do this here: http://codebetter.com/blogs/darrell.norton/archive/2003/07/01/361.aspx I have a checkboxlist that I'm generating the string from, so the string could look like this: "1,3,4,5,7" etc.I added the function mentioned in the URL above to my database, and if I understand right, I should be able to pass the table it creates into the select statement like so: WHERE (OrderStatus IN ((select value from dbo.fn_Split(@StatusList,','))) OR @StatusList IS NULL) but now I don't know how to assign the string value to the parameter, say to '@solution_id'.my current select statement which was generated by Visual Studio 2005 looks like this: SELECT [test], [owner], [date] FROM [test_table] WHERE ([solution_ID] = @solution_ID) ...but this only pulls results for the first item checked in the checkboxlist.Does anyone know how this is done? I'm sure it's simple, but I'm new to ASP .NET so any help would be greatly appreciated.
Hello,I am currently trying to assign some string to a TEXT output parameterof a stored procedure.The basic structure of the stored procedure looks like this:-- 8< --CREATE PROCEDURE owner.StoredProc(@blob_data image,@clob_data text OUTPUT)ASINSERT INTO Table (blob_data, clob_data) VALUES (@blob_data, @clob_data);GO-- 8< --My previous attempts include using the convert function to convert astring into a TEXT data type:SET @clob_data = CONVERT(text, 'This is a test');Unfortunately, this leads to the following error: "Error 409: Theassignment operator operation cannot take a text data type as an argument."Is there any alternative available to make an assignment to a TEXToutput parameter?Regards,Thilo
I use SQL Server 2005 and in a Stored Procedure I want to execute a sql statement and assign the result to a variable. How can I do that?The name of the column I want to retreive the value from is "UserID"Here's my SP so far: ALTER PROCEDURE [dbo].[spUnregisterUser] @UserCode int AS BEGIN SET NOCOUNT ON; declare @uid uniqueidentifier --get userid SELECT @uid=UserID FROM tblUserData WHERE UserCode=@UserCode -- Delete user UPDATE tblUserData SET IsDeleted='True' WHERE UserCode=@UserCode END
I have this query and I tried this but am getting the error for the case statement when I assign the nulls to a 0:
The error is they data types of the result expression of a CASE expression are not compatible.
SELECT 'C' as account, FUND_dim.fund_cde as FUND, case when sum(BRKGRPTT.daily_brkg_fact.accum_unit_cnt) is null then '0' else sum(BRKGRPTT.daily_brkg_fact.accum_unit_cnt) end as Units_Purchased FROMFUND_DIM left outer join BRKGRPTT.daily_brkg_fact on FUND_DIM.FUND_ID_NUM = BRKGRPTT.daily_brkg_fact.FUND_ID_NUM and BRKGRPTT.daily_brkg_fact.SEP_ACCT_ID_NUM <> 1 left outer join SEP_ACCOUNT_DIM on BRKGRPTT.daily_brkg_fact.sep_acct_id_num = SEP_ACCOUNT_DIM.sep_acct_id_num group by BRKGRPTT.sep_account_dim.sep_acct_cde, BRKGRPTT.fund_dim.fund_cde order by FUND_dim.fund_cde
How do I assign XmlDocument results to a variable (so that I can pass it to a sp)?
I know that the following code works....
select * from tblUsers where userId = 1225 for XML raw
It returns "<row UserId="1225" LastName="Evans" FirstName="Stephanie" MiddleInitial=...."), which is what I want. But when I try to assign it, I get an error "Incorrect syntax near 'XML'."
declare @strXml nvarchar(1000)
set @strXml = (select * from tblUsers where userId = 1225 for XML raw)
I'm developing a vb 2005 application and I€™m creating the users directly to the database. I want to assign them names.
I want to do something like this: CREATE TABLE admin.db_users ( id INT CONSTRAINT db_user_pk PRIMARY KEY, [name] VARCHAR(50) CONSTRAINT db_user_name_nn NOT NULL, authentication VARCHAR(25) CONSTRAINT db_user_authentication_nn NOT NULL, CONSTRAINT db_user_fk FOREIGN KEY(id) REFERENCES sys.database_principals (principal_id) ON UPDATE CASCADE ON DELETE CASCADE ); GO
This is the error that i'm getting: Msg 1767, Level 16, State 0, Line 1 Foreign key 'db_user_fk' references invalid table 'sys.database_principals'. Msg 1750, Level 16, State 0, Line 1 Could not create constraint. See previous errors.
How do I solve this problem or how can I do something similar.
Hi My webpage contain three dropdown box and one button. One dropdown to choose hospital_id, second dropdown to choose project_id and third dropdown to choose version_no .After choosing these three and when the button is clicked i want to run this sql query INSERT INTO version(project_id,hospital_id,date_created,comments) SELECT project_id,hospital_id,date_created,comments FROM version where version_no=@version_no and project_id=@project_id and hospital_id=@hospital_id. Just i need the code in asp.net 2.0 , VB , when the button is clicked the above query should run and the parameters (values) should take from dropdown box. Could anyone please send the solution for the above problem.
myConnection.Open() Dim myPuzzleCmd2 As New SqlCommand("GetRandomCode", myConnection)
myPuzzleCmd2.CommandType = CommandType.StoredProcedure Dim retLengthParam As New SqlParameter("@Length", SqlDbType.TinyInt, 6) retLengthParam.Direction = ParameterDirection.Input
myPuzzleCmd2.Parameters.Add(retLengthParam) Dim retRandomCode As New SqlParameter("@RandomCode", SqlDbType.VarChar, 30)
Try Dim reader As SqlDataReader = myPuzzleCmd2.ExecuteReader() myPuzzleCmd.ExecuteNonQuery()Catch ex As Exception
myPuzzleCmd2 = Nothing Session.Remove("RandomCode") HttpContext.Current.Session("RandomCode") = myPuzzleCmd2("@RandomCode") < --------- Over here Finally myConnection.Close() End Try
Hi I have add one new database mdf file in my project by ---> add new Item in to project. But This database.mdf file is in windows authetication mode. So there is no password assign to this. I want to assign use id and password to this database or I want to give sql server authetication mode. I have tried Modfy Connection property of database but that is not working. what is the default username of this conncetion????? REply.....
I have created a program that allow the user to register account as new user to sql. I do not want everyone use the same account (default sa).Now i want to group those users into one group which easy for management.But I cant find way to create new login group.I search over net, they said need to done under computer management--local user and group, but my computer do not have local user and group..
I am trying to automatically insert records into my existing customer table. Is there a way when I insert these new records and assign the customer number that it can sequentially pick the next available unique customer number for each record that is inserted? for example the first record would be customer number 100, the next 101, and so on? Please advise.
My issue is that I have 10 accounts that were assigned to 5 agents with each agent receiving 2 accounts. I would know like to randomly reassign the accounts with the only criteria being that the random allocation not reassign to the same agency and each agent gets 2 accounts again.
Data looks like below and I want to populate the randomly assigned agent in the "Second_Agent" column.
I have the qry, which is suppose to assigned records to active user (almost 15 users) equal, but it doesn’t- sometime it assigned more to some users and less to others. How could I modify my qry to make sure it assigns the records equals to each user? Please, see the qry below. I will appreciate any help
Thk
UPDATE TBLFRAUDFINDER SET DATE_ASSIGNED=GETDATE(), FRAUDANALYSTASSIGNED=@FRAUDANALYST WHERE FRAUDID=@FRAUDID OR (FRAUDANALYSTASSIGNED IS NULL AND ((INQUIRY_GOVT_NUMBER=@INQUIRY_GOVT_NUMBER) OR (CUST_NM=@CUST_NM) OR (ALERT_IDENTIFIER=@ALERT_IDENTIFIER) OR (ACCT IN (SELECT ACCT FROM TBLFRAUDFINDER WHERE INQUIRY_GOVT_NUMBER=@INQUIRY_GOVT_NUMBER OR CUST_NM=@CUST_NM OR ALERT_IDENTIFIER=@ALERT_IDENTIFIER))
Here is my issue. I have a list of merchants (generated daily) and Ineed to assign them eually to a set of analysts. Both the merchantlist and analyst list can change daily. I want to assign each merchantwith an analyst daily and need help to write out a stored procedurefor this (do not want to use VB).Here is relevant code for the tables:CREATE TABLE MerchList (MerchListID int IDENTITY (1, 1) NOT NULL ,FileDate datetime NOT NULL ,MerchID int NOT NULL ,AnalystID int NOT NULL ,)CREATE TABLE tblAnalyst (AnalystID int IDENTITY (1, 1) NOT NULL ,AnalystName varchar(100) NOT NULL)there will be about 10000 records in table MerchList and around 25records in table tblAnalyst.This will be used to assign work to analysts on a daily basis.Thanks for all your help!Vishal
I am trying to achieve a seemingly simple task of assigning datetime value to a user variable at the point my package starts running. How can I do this without using a SQL Script Task? Should I be using a script task for this or is there a simpler way to achieving the same thing?
im using the Northwind database, i use T-SQL commands to create a view that restricts users from seeing the address, city for all employees. i dont know how to assign the view to a user in the database using Enterprise manager. pls help me, im really needing a answer. thanks!
I deployed a clustering project. As a result, I got 10 clusters. Is there an automatic way to create a table with the customer ID and the cluster # that each customer was assigned to?
I have a column with int data type.. i am trying to assign this column to a variable ( int) in For Each Loop..but it keeps giving me an erro
The type of the value being assigned to variable "User:ubcontractor_Key" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.
Am i getting this error becasue the column has NULL value?. how can I resove this probelm?
I have a simple Execute DTS task which uses ADO.NET connection to update variable........and get the following error.
Variable:
@msg string
Query:
Select @msg = 'Invalid Process Dates'
[Execute SQL Task] Error: Executing the query "Select @msg = 'Invalid Process Dates'" failed with the following error: "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 3 ("@msg"): Data type 0xE7 has an invalid data length or metadata length.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Any one has clue how to fix it? I could use the OLEDB connection to get it work but I need to use ADO.NET. Any help will be appreciated.
There is a configuration file which is used to hold a connectionstring for the ssis packages. Once the configuration file is created then is it necessary to go to each package and then package configuration to point the package to the configuration file? It seems the packages do not automatically refer to the config file. Instead each time the config file is changed then all the packages have to be pointed to the config file one by one. i.e. going from Dev to live. Am I right? Thanks
I am trying to use a variable to set an attribute value of an SSIS task but I keep running into the 4000 character limit of the string variable. Not sure why the variable which is of .NET type String has this limit when it doesn't when you are in a .NET environment. Regardless, can anyone provide some sample code that I could use to do this in a script task? I am trying to set the QueryString property of the Data Mining Query Task. All help would be appreciated.