First I check if the ABBR exists, then I update it. It seems like I am making 2 requests - 99% of the time I would never send the wrong parameters so it's just a check.
I was wondering if there was a way to ask AND update in one step?
[code]
ALTER PROCEDURE [dbo].[League_GetTeamA bbr]
(@LeagueID int, @TeamName nvarchar(50), @Abbr nvarchar(10) OUTPUT)
As
IF Exists(SELECT ABBR from League_TeamData...
User Profile
Collapse
-
Faster way to check if a record needs updating
-
If you use the build in Login control of asp.net it's pretty simple. Put this in the Loggedin event of the login control. You could easily use a Select...Case or simple If..Then if you wish.
...Code:'redirect user based on the role If Roles.IsUserInRole("LeagueAdministrator") Then Response.Redirect("~/users/AccountHome.aspx") ElseIf Roles.IsUserInRole("LeagueOfficial") -
jeffstl - you have to "store" the state somewhere - there are many different ways to do it but definitely the easiest is store it in a session variable. Session variables are very simple to work with....Leave a comment:
-
michael I dont have a direct answer but lets brainstorm...
psedo tsql code:
...Code:WHILE (SELECT REP FROM REPS WHERE REPZIP = @SEARCHEDZIP) BEGIN IF (SELECT COUNT(REP) FROM REPS WHERE REPZIP = @SEARCHEDZIP) > 0 --we have the rep BREAK ELSE --increment the zip SET @SEARCHEDZIP = @SEARCHEDZIP + 1 CONTINUELeave a comment:
-
Sunny I am confused (more my fault than yours) but let me throw something out there.
On load or however you choose initially, load the data in the first combobox. Then after the first combobox is selected, fill the 2nd (OnLeave, SelectedIndexCh anged)....Leave a comment:
-
Definitely. Whenever you have a One-to-many relationship you should strongly consider two tables. I say strongly consider bc there could be a reason to keep it all in one table but I wouldn't do it . Even if it works for you today, your scalability is shot (in case you want to make the database bigger/expand your project).
So to your case: I absolutely would have 2 tables in a One-to-many relationship where Table A (Order Master) relates...Leave a comment:
-
Bobby I have this in a app (both form and web) where I log the time when the user logs in and the user logs out. On successful login and logout I write the time to the database.
Would that work?...Leave a comment:
-
panuvin just a guess have you thought of creating a custom pop up box - just a form that pops up?...Leave a comment:
-
pelusa what it sounds like is you are just creating simple master / detail tables. If thats the case lets call table "A" the master table and table "b" the detail table. Kind of like Invoice/Invoice Details.
Table "A" should NOT have item numbers in it. Keep your data normalized (google 'database normalization') . Even if the order only has one item its ok to have one master record and one detail record....Leave a comment:
-
Ok gail that makes sense I read it too fast - let's see....
I assume we have some master info on the form then a detail (gridview) on the bottom? Not knowing all the details I can just throw out suggestions.
On form load if there are no rows in the detail then automatically add one. OR on gridview_enter if there are no rows you can add one.
After a row is added you can then set addnew = false. Check to...Leave a comment:
-
kwank I have a really hacky solution for this which I have done once. I had a similar problem with a client machine that turned in to pebcak anyway what I did was I wrote to the database with a time as the code executed. Just info I could understand e.g. ("Sub: executeLoad, line 128, 1/12/2008 12:04:44.000").
If you dont want to write to a database store the data in a string and pop it up in a msgbox after the app loads...Leave a comment:
-
I'll give it another shot.
Page loads.
User presses button to load textbox
User may optionally change text in textbox
If user changes text in text box user clicks a button to save changes.
Before I continue am I correct? vb.net may have limitations but this is not one of them....Leave a comment:
-
jrs So you load the page and the value is filled in the textbox? I understand you are lost but at which part? You want to write the textbox value back to the database?
You need a button or some other way to commit the change. If it's a vb.net form the sysntaxt for the text box value is 'me.textbox1.te xt' where textbox1 = the name of your textbox....Leave a comment:
-
To prevent adding new rows you need to handle a focus event from the datagridview. First I would set Addnew = false for the gridview. Then set it to true after meeting your conditions.
Here's code I have that does something similar from the CellEnter event of the gridview:
...Code:Dim m_RowIndex As Integer = e.RowIndex If e.ColumnIndex = Me.InsertionOrderDetailDataGridView.Columns("NetCost").Index ThenLeave a comment:
-
Sonia - By random strings do you mean in the address bar? If that is correct they are either a session ID value or a GUID value returned from the Yahoo database that points to your newly added account....Leave a comment:
-
VB-WEB: Property vs. Public Shared Variable
I am still trying to get my arms around properties and why I should use them more. But I just cannot understand when I should be using properties as opposed to just declaring a 'public shared' variable?
For example, if I am creating an MDI app and I want to store the CustomerID that gets passed between various Customer Detail forms, why not just set the CustomerID variable to the customerid on the MDI parent? -
VB.Net-FORM - Multiple Connections to Sql Server
I have a table adapter with multiple queries. I have code that calls many of these queries (stored procedures) within a For...Next loop. It reuses the declared object many times.
Should I be releasing the object somehow between loops? I feel like the code is excessively slow. Each time a query is called, am I creating a new connection to SQL server or does it open, close, reuse?
Here is a sample. As you can see I reuse... -
svc I am pretty sure the only way you can read a raw pdf is to convert it to bytes. I don't think you can read it like a text file....Leave a comment:
-
neehakale this is what I use in vb.net. This is for the down key, but you could set it up for any key or multiple key presses. Maybe you could convert it to C# with the vb.net to c# converter?
...Code:If e.KeyCode = Keys.Down Then Dim cur_cell As DataGridViewCell = _ InsertionOrderDetailDataGridView.CurrentCell Dim col As Integer = cur_cell.ColumnIndexLeave a comment:
-
Pelusa -
In the Form Load did you try this:
Me.DateTimePick er1.Value = dateadd(DateInt erval.Day, 7, Date.Today)
(Where DateTimePicker1 is the name of your date picker)...Leave a comment:
No activity results to display
Show More
Leave a comment: