Hi Thanks for bumping me in the right direction i have managed to solve it with your input! ALTER PROC [dbo].[FindCupByCupIdAndDescription] @CupID int, @CupDescription nvarchar(50) AS IF EXISTS(SELECT CupID FROM Cupboard WHERE CupId = @CupId) SELECT * FROM Cupboard WHERE CupId = @CupId ELSE SELECT * FROM Attic WHERE CupDescription LIKE '%' + @CupDescription + '%' this is a really simplified example but is essentially the logical illustration of what i was hoping to achieve using a result as a condition. :-D Thanks you.
butchzn
Posts
-
Transact SQL conditional Select -
Transact SQL conditional SelectHi Everybody :) , How would i execute 2 select statements in 1 stored procedure using TRANSACT-SQL? The execution of the 2nd procedure is conditional and based on whether the 1st statement returns any values or not? Essentially as an example: select * from cupboard where cupColour = 'white' if cupboard.CupsFound = 0 then select * from cupboard end if return dataset Any help would be greatly appreciated...i will continue to search and read :)
-
Highlight Text in TextboxThanks for the replies. Really appreciated. The focus definitely works, thank you, however i have multiple textboxes that i am looking for matches in and would like to highlight any matches in all the necessary textboxes. Setting the focus would only then highlight 1 textbox. Any suggestions would be welcome. Thanks again.
-
Highlight Text in TextboxI am attemptimg to programmatically highlight a selection of text in a textbox. I trying to achieve this by so doing:
tbxItemUrl.SelectionStart = 0;
tbxItemUrl.SelectionLength = pageDetailItemSection.tbxItemUrl.Text.Length;
tbxItemUrl.SelectionBackground = new SolidColorBrush(Colors.Yellow);
tbxItemUrl.SelectionForeground= new SolidColorBrush(Colors.Black);but to no avail. some resources...i have attempted to try [][^] Has anybody successfully managed to do this...thanks
-
WCF - Svn ErrorHi guys, Not sure where to post this... I have a Silverlight application that interacts with a service hosted in the hosting website. The service performs operations like getting data etc. A key function of the service is to obtain the current file state(this is where svn comes in). When running this website in Visual Studio all functions work correctly and as expected. After publishing the website and browsing via IIS, my calls to SVN return an error stating "svn: Error resolving case of 'M:\MySite\mypage.xml'. All calls to other methods in the service still work fine...just the svn calls throw errors. I have attempted to find any related issues and the most likely answer i have received is that it is possibly related to permissions http://jimmers.info/wordpress/2009/08/05/104/. My current setup of IIS is as follows: I have AnonymousAuthentication enabled as well as WindowsAuthentication. My Web.Config contains the following entry. <authentication mode="Windows" /> My Question is...how do i get the service to process as the logged on user? If that will solve my problem? Thank you in advance
-
Using Regex to find a MatchHi Guys, Please could someone assist me... I am trying to extract the text placed between i love puppies using regex. I have html in a variable and i am trying to establish whether an anchor tag exists in this string that contains "i love puppies" or if need be "love puppies". I have attempted to using this MatchCollection mAnchor = Regex.Matches(originalStr, @"(<a[^>]*> ('text'[^<]*) </a>)*", RegexOptions.IgnoreCase); but due to my lack of deeper understanding of regex...i have not been successful... Thank you in advance, Butch
-
Losing Session Variables within FramesWould this help? Frames, Sessions, and P3P[^]
-
How to access the contain of master page in our cs file?If what you asking is how to access controls in a Master Page from code-behind...
MyMasterPage myMaster = (MyMasterPage)this.Master;
string ImgStr = "images/test.gif";
//Calling a method from MyMasterPage
myMaster.setMasterHeaderImages(ImgStr);
myMaster.Page.Title = "Test Page Title";Check http://aspadvice.com/blogs/kiran/archive/2005/11/27/14016.aspx[^] here.
-
validation<asp:TextBox ID="tbEmail" runat="server" ValidationGroup="Register" />
<asp:RegularExpressionValidator ForeColor="Red" ValidationGroup="Register" ControlToValidate="tbEmail" ErrorMessage="Email Address is not valid." ValidationExpression="^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$" EnableClientScript="true" ID="RegularExpressionValidator1" runat="server" Display="Dynamic" />
Or you could create a custom validator that will do the validation for you and set your page IsValid property to true or false depending whether valid or not.
-
Logout > Back Button in BrowserHi Guys, When i LogOut a user on my site a User is still able to hit the Back button in their browser and essentially view a logged in only page. Ideal scenario would be for this page to send them to Login screen. What would be the best way to stop this from happening? FYI. When a user logs in, i store a loggedIn value in a session variable. On logout i reset this session to indicate the user is loggedOut. I am using c# .net Many Thanks.
-
Logout -> Browser Back Button = Login PageHi Guys, When i LogOut a user on my site a User is still able to hit the Back button in their browser and essentially view a logged in only page. :( Ideal scenario would be for this page to send them to Login screen. What would be the best way to stop this from happening? FYI. When a user logs in, i store a loggedIn value in a session variable. On logout i reset this session to indicate the user is loggedOut. I am using c# .net Many Thanks. :)
-
What am i missing? Tables in my DataContext do not have Add or Remove optionsHi Guys, i had the same issue after reading your post i figured it out! Thanks. I thought i would pop some code on it for all to see :-\ hope it helps someone like u guys helped me public partial class _Default : Page { protected void Page_Load(object sender, EventArgs e) { AddUser(); BindData(); } public UserClass AddUser() { DataClasses1DataContext db = new DataClasses1DataContext(); //Where User is the Class Generated by LINQ that is mapped to my DB Table LinqMapping.User user = new User(); user.Name = "Butch"; user.Surname = "Zn"; user.Active = true; db.Users.InsertOnSubmit(user); db.SubmitChanges(); return null; } public ICollection<UserClass> GetUsers() { DataClasses1DataContext db = new DataClasses1DataContext(); var userList = from u in db.Users select u; ICollection<UserClass> list = new List<UserClass>(); foreach (var user in userList) { list.Add(new UserClass {Id = user.id, FirstName = user.Name, Surname = user.Surname, Active = user.Active}); } return list; } public void BindData() { ICollection<UserClass> user = GetUsers(); GridView1.DataSource = user; GridView1.DataBind(); }
-
Add 2 values in RepeaterHi Todd, Thanks for your response.:cool: While your solution is one that will work i eventually found a way to do it all front end :) <ItemTemplate> <td><%#(Convert.ToInt32(Eval("Column1")) +Convert.ToInt32(Eval("Column2"))/100)%></td> </ItemTemplate> Thanks again.
-
Data binding in Classic ASPHi, This is the way i usually bind data to asp controls <% 'get friends getFriendsSQL = "SELECT [ID], [Name] FROM Friends ORDER BY [Name] ASC" set friendsRS = searchConn.execute(getFriendsSQL) if not friendsRS.eof then friendsCheck = friendsRS.getRows friendsCount = ubound(friendsCheck,2) end if %> <select name="friendSelect"> <option value="0">- -<i>Select Friend</i>- -</option> <% if isArray(friendsCheck) then for u = 0 to friendsCount %> <option value="<%= friendsCheck(0, u) %>"><%= friendsCheck(1, u) %></option> <% next end if %> </select> Hope this helps.
-
Add 2 values in Repeater:) Hi All, I have a repeater that uses an XML file as its datasource. I want to add 2 of the retrieved values. How would i do this without messing with the DataSet in code behind? <ItemTemplate> <td> <%# DataBinder.Eval(Container.DataItem, "ISLTournamentBuyIn")%> + <%# DataBinder.Eval(Container.DataItem, "ISLTournamentFee")%> </td> </ItemTemplate> Thanks.
-
Databinding to Textbox using C# and .NET:)Hi guys, i am using c# in my web app for the first time and have no clue how to get retrieved records to bind to a textbox. i have successfully connected to the db and have databinded a few datagrids but i can't seem to get the textbox to show a value retrieved from the db. please could someone be kind enough to show me the correct way to go about this. thanks so much
-
uploading to images to remote serverhi all, i would like to write C# code that would allow a user to upload images to a file on a remote server any ideas or solutions for me pleez. this would require ftp access and i am uncertain how i am going to integrate this into the app. the idea is the to upload new images when the need arises... many thanks butchzn
-
upload pictures to remote serverhi all, i would like to write C# code that would allow a user to upload images to a file on a remote server any ideas or solutions for me pleez. this would require ftp access and i am uncertain how i am going to integrate this into the app. the idea is the to upload new images when the need arises... many thanks butchzn
-
Alphabetical sorting - SQLthanks very much pbpb this has proved to be very useful. thanks again
-
Alphabetical sorting - SQL:)Hi can anyone pleez assist me, i am trying to sort my db results by first letter... ie a, b, c etc how would i go about this using SQL. i want to be able to select a letter and have it order my all results by that chosen letter. Thanks very very much Butch