|
Paul Watson wrote:
Oh wait I just figured it out. You are missing a closing bracket on the end of your command string. Change builder.Append("\' as VARBINARY"); to builder.Append("\' as VARBINARY)");
Oh!
So I did a miss in the command string anyway!!!
Paul Watson wrote:
Helpful tip #1 for SQL: Always Response.Write your command strings out to check them. Then copy and paste that string into Query Analyzer and run it to pick up any errors. Best debugging method I have ever learnt for SQL
Query Analyzer?
Is it an built in tool or what in Access 2000?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Rickard Andersson wrote:
Is it an built in tool or what in Access 2000?
SQL Server tool. Just do a query ("fråga" in Swedish) in Access
--
Please state the nature of your medical emergency.
|
|
|
|
|
Jörgen Sigvardsson wrote:
("fråga" in Swedish)
Nice!
Then I know how to debug a SQL query in Access 2000!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
I am loosing my mind here and want to make sure that I am not simply trying to do somehting that can't be done, allthough I can't belive that it can't be done really.
Problem:
I want to keep a simple counter on my website that tracks how many people are logged in. The value of this counter should be placed onto a label control when a page is loaded.
Proposed Solution:
I have this code in my global.asax file...
Public Class Global
Inherits System.Web.HttpApplication
Protected Shared m_ActiveUsers As Integer
#Region " Component Designer Generated Code "
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
Private components As System.ComponentModel.IContainer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#End Region
Public Shared ReadOnly Property ActiveUsers() As Integer
Get
Return m_ActiveUsers
End Get
End Property
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Application.Lock()
m_ActiveUsers = 0
Application.UnLock()
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Application.Lock()
m_ActiveUsers = m_ActiveUsers + 1
Application.UnLock()
End Sub
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request
End Sub
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires upon attempting to authenticate the use
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Application.Lock()
m_ActiveUsers = m_ActiveUsers - 1
Application.UnLock()
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub
End Class
I have this code in my WebForm.aspx.vb file
Private Sub Page_Load(ByVal sender As System.Object,_
ByVal e As System.EventArgs) Handles MyBase.Load
lblVisitors.Text = Global.ActiveUsers.ToString + " Visitors"
End Sub
The problem is that the label contents are ALWAYS blank!
Any ideas out there as to what I am doing wrong?
Help me please before I decide to do something drastic!
|
|
|
|
|
Ok, took a while but I found out aparently what my darn problem was...
I never hit the rebuild button
|
|
|
|
|
Okay... my turn...
Is there a better way of doing this?
<script></script>
<script for="ddlPlayer" event="onfocus"></script>
<script for="cbExistAsGM" event="onfocus"></script>
<script for="cbExistAsTO" event="onfocus"></script>
<script for="tbFullName" event="onfocus"></script>
<script for="tbNick" event="onfocus"></script>
<script for="tbEmail" event="onfocus"></script>
<script for="tbLocation" event="onfocus"></script>
<script for="cbNewAsGM" event="onfocus"></script>
<script for="cbNewAsTO" event="onfocus"></script>
<script for="cbNewAsTMC" event="onfocus"></script>
I don't want to use onfocus="ChangeRB();" because they're actually <asp:...> tags, which have a tendency to deal with events on the server. So what I'm looking for really is a way to say "execute this script when focus moves to any of these controls..."
This works fine as it is but it seems like a waste of bandwidth to me so any abbreviated way of doing it would be a bonus.
Paul
|
|
|
|
|
Paul Riley wrote:
=
<script for="cbNewAsTMC" event="onfocus">ChangeRB(false);</script>
minus 8 bytes
Paul Riley wrote:
I don't want to use onfocus="ChangeRB();" because they're actually <asp:...> tags, which have a tendency to deal with events on the server. So what I'm looking for really is a way to say "execute this script when focus moves to any of these controls..."
Why not? Thats what ASP.NET uses onclick="__DoPostBack()" in their controls...The function gets control control of what is going to be done.
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
leppie wrote:
minus 8 bytes
Hmmm... I prefer to keep the commenting in there, just in case someone has scripting blocked or for some reason is using a browser that doesn't support it.
leppie wrote:
Why not? Thats what ASP.NET uses onclick="__DoPostBack()"
I had a problem doing this with a text box onchange but looking again, I might have done something stupid like using OnTextChange because I can't see why it would go wrong.
Ho hum, I'll try it that way then
Paul
|
|
|
|
|
Using "onfocus=" doesn't work.
For some obscure reason that I can't see, it doesn't work at all for the drop down list. It does work for the textboxes but the checkboxes are wrapped with a SPAN tag which gets the onfocus; no use to me.
Sigh! Oh well. Back to the inefficient method unless someone has something else...
Paul
|
|
|
|
|
Paul Riley wrote:
It does work for the textboxes but the checkboxes are wrapped with a SPAN tag which gets the onfocus; no use to me.
Why are you doing that?
<input onfocus="function()" will do it, not?
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
NO! I'm using WebForms so the declaration is
<asp:CheckBox id="cbNewAsTMC" runat="server"></asp:CheckBox>
Paul
|
|
|
|
|
Paul Riley wrote:
NO! I'm using WebForms so the declaration is
<asp:checkbox id="cbNewAsTMC" runat="server">
Just override RenderContents() and add the event to the input tag that you will have todo yourself (its only one line, just check the output in a webpage and copy/paste). The style will still be preserved.
Hope this helps
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
Oooo, now that's an idea! I haven't played with WebControls yet but that's a good plan. Cheers leppie.
Paul
|
|
|
|
|
Paul Riley wrote:
I haven't played with WebControls yet but that's a good plan.
Yes, its very easy
Just make your control in your favourite HTML editor. Copy the HTML to C# strings, make some variables and use String.Format() to assign in HTML. As easy as pie (not that I ever made one, but at least I'm eating one now )!
Cheers
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
actually, CheckBox is a special case. MS made some tradeoffs with CheckBox and RadioButton which aren't readily apparent until you try to add script to them. The surrounding span tag exists so that styles applied to the checkbox will also apply to the label.
one would be better off using the HtmlInputCheckBox and HtmlInputRadioButton for these types of issues. This is because these two more closely match the API for the html elements, and thus have better javascript integration abilities.
|
|
|
|
|
I have a result set in an array of objects, which I bind to the data grid. How can I page this? I tried the properties, I actually paged, except that inspite of clicking on page 1 or 2, it always shows page 1. How does page 2 get shown?
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
When you click on a page link, it simply throws back a PageIndexChanged event which you then need to handle. DataGrid1.CurrentPageIndex = e.NewPageIndex will change the page for you but note that you must DataBind the grid after you change the index.
Paul
|
|
|
|
|
Thank you.
I am getting used to others doing the work for me
modified 29-Aug-18 21:01pm.
|
|
|
|
|
The paging works! Thanks again.
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Hi all
I have a TextArea in a TABLE, but I want it t occupy the width of the table. How can this be done? COLS property is not handy at all!
CHeers
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
I think you can use width="100%" but I also have it in mind that this only works in IE5+. I may be wrong on both counts. I tend to stick to set widths wherever possible with textboxes; not pretty but it works and with all browsers.
Paul
|
|
|
|
|
|
Roger Wright wrote:
Use COLSPAN instead.
Doesnt work either....
Thanx
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Give us an example of your code.
Paul
|
|
|
|
|
OK
I have tried the COLSPAN in the TD , and width in TD.
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|