You cannot use an IN with a variable. Either use dynamic sql or, my preferred method, use a function to split the list into a table variable and join on that. A quick google will give you examples, but here is a starter
CREATE FUNCTION [dbo].[fn_DelimitedSplit]
@TextToSplit VARCHAR(8000), @Delimiter VARCHAR(255)
RETURNS @SplitKeyword TABLE (Keyword VARCHAR(8000),seq int identity)
DECLARE @Word VARCHAR(255)
WHILE (CHARINDEX(@Delimiter, @TextToSplit, 1)>0)
SET @Word = SUBSTRING(@TextToSplit, 1 , CHARINDEX(@Delimiter, @TextToSplit, 1) - 1)
SET @TextToSplit = SUBSTRING(@TextToSplit, CHARINDEX(@Delimiter, @TextToSplit, 1) + 1, LEN(@TextToSplit))
INSERT INTO @SplitKeyword(Keyword) VALUES(@Word)
INSERT INTO @SplitKeyword(Keyword) VALUES(@TextToSplit)
Bob Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
Using Visual Web Developer Express and SQL Server 2005 on an XP development machine.
Was using development server in VWDE to view pages, using following connection string:
|add name="RHConnectionString" connectionString="server=MIKE;database=Rotary;Trusted_Connection=True;"/|
Needed to test with SSL. Installed SSL certificate (using your makecert procedure, thanks). Moved web site to IIS and opened in VWDE. Development connection to database works, but pages get Login failed for user 'MIKE\IUSR_MIKE'.
SQL Server configured for Remote Connections and mixed Windows Authentication and SQL Server authentication.
Go to your management Studio. Right click your Server and go to properties. in the Properties go to Security and look at the Options under Server Authentication. and tell us what is selected there.
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
Dont know if this may help but worth a try go to SAL Server Surface Area Configuration and then Surface are configuration for services and connections. Choose Remote connections, check Local and remote connections and choose TCP/IP only. Hope this helps
Okay, I'm new to the whole ADO.NET stuff, so don't punish me to hard if I ask a total bullshit question...
First, here's a piece of code (assume, aDataSet is already initialized and the table "aTable" also exists):
Dim aRow As DataRow
For Each aRow In Me.mDataSet.Tables("aTable").Rows
aRow.Item("isParent") = True
What I wanna do: Add the new column "isParent" to "aTable" (okay, I managed this), and initialize it with a standard value (I do this in the for-next-loop). But I thought, there must be a more elegant way to do this, without picking every single cell in a loop. Anyone know a good solution?
I don't need to write in a database, 'cause my aDataSet is build on the fly, without database representation.
U can enter only enter those values in table2(Rank) which are present in Primary Key.
This is the fundamental of having a foreign key. If you want to add values other than those in primary key remove the constraint.
I have multiple results for 1 user. In the example I want the results to get to one row, with the final result (True, True, True, True, True).
So the query has to go through all the results and check if the Access Right is True or False. Is one of them is True the result of the column is true.
I tried to use Temp Tables but im stuck Anyone has an idea?
which would be much easier to query (you can join on ID; you can select on right=true, etc), as well as easier to extend when new access numbers become necessary.
Luc Pattyn [Forum Guidelines][My Articles] The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.