|
|
I use the following function to test whether a string is alphanumeric. If it does not contain any of these characters, then it will display an error. Now I have an error with the element because I pressed enter a couple of time, and it doesn't pick it up here? How do I enter the enter character in the function below? I hope you understand. This a valid text Good moring, but when I do the following then there is an error,
Good moring
Good moring
Good moring
function isAlphaNumeric(str)
{
var i;
for(i = 0; i < str.length; i++)
{
if(!( ((str.charAt(i) <= '9') && (str.charAt(i) >= '0')) ||
((str.charAt(i) <= 'z') && (str.charAt(i) >= 'a')) ||
((str.charAt(i) <= 'Z') && (str.charAt(i) >= 'A')) ||
(str.charAt(i) == ' ') || (str.charAt(i) == '-') ||
(str.charAt(i) == 'é') || (str.charAt(i) == 'ë') ||
(str.charAt(i) == 'ê') || (str.charAt(i) == 'ü') ||
(str.charAt(i) == '_') ))
return(false);
}
return(true);
}
Your help and time is appreciated!!!
Thanks
BRENDAN VOGT
|
|
|
|
|
Does checking for a carriage return (char 13) work?
e.g.
if (..... &&(str.CharAt(i) == 13)
store your internet favourites online - www.my-faves.co.uk
|
|
|
|
|
If I have an empty textbox, and the related field in the database table does not require a value, is better to write the value as '', or should I enter a NULL value? If the value is to be written as a NULL value, how do I convert the empty textbox field into a NULL value in my SQL string? I use Request.Form("txtDescription") to retrieve the value, but how do I test and convert it into one line, is this possible?
Your help and time is appreciated!!!
Thanks
BRENDAN VOGT
|
|
|
|
|
Brendan Vogt wrote:
If I have an empty textbox, and the related field in the database table does not require a value, is better to write the value as '', or should I enter a NULL value?
That depends on your datamodel. A NULL value is typically defined as meaning an absence of data. Whereas an empty string could mean that there is data and it was an empty string.
I read recently, although I've not tested this myself, that adding NULL values to a database slows it down and so should be only used where necessary. In other words you should only use it if you genuinely have a need to represent a gap in the data.
There is a System.DBNull[^] class in the .NET Framework to represent Null values in a database.
When you create your SQL Command you assign DBNull.Value to the relevant parameter. When you read data from the database you need to check the object being returned to see whethere it is a DBNull.Value before doing anything else with it. This adds extra steps to the process when you read and write data to the database.
If you still can't decide one way or the other: I would say that for a description field, an empty string would be better than a null value.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
|
I'm still using plain ASP, and not ASP.NET
|
|
|
|
|
Sorry, I'm not familiar with SQL Server/ASP.
|
|
|
|
|
I use the GetRows() method to work with my fields retrieved from a table query in ASP.
After I open the recordset, I do the following:
If Not objRs.EOF Then
arr = objRs.GetRows()
End If
I have 3 questions with regards to using the GetRows() method:
1. arr is used as an array. I don't have much experience with arrays. Must they be set to nothing when I have finished using it? Something like Set arr = Nothing
2. I was told to do what is necessary with the recordset and to close it ASAP. If I return one row from the table, can I use the recordset to populate my fields, or should I rather assign it to an array like I did above? I just need to know when is it most appropriate to use the GetRows() method, only when many rows are returned, or for a few rows as well?
3. How would I do this same thing in Visual Basic 6? I don't know how to declare an array in VB6.
Your help and time is appreciated!!!
Thanks
BRENDAN VOGT
|
|
|
|
|
We have an on-line computer support site that resides on our server and is accessed via our Intranet. Our employees use it to submit computer related problems to our IT personnel. One of the required fields they must input is their local computer name. Unfortunately, most of our employees have NO idea how to obtain this information.
I would like to have a script that will automatically pull thier local computer name and input it into the "computer name" field on said page.
I've been unsuccessful scouring the web for such a beast, if anyone has the complete code and is willing to share, I would appreciate it very much.
Thank you!
|
|
|
|
|
|
See the Win32 API function GetComputerName(LPSTR ComputerName, DWORD *dwpSize);
You can write a module around this function (Browser Helper Obj, COM component, ActiveX, etc.) and have it installed on the client's computer.
onwards and upwards...
|
|
|
|
|
|
I have an error:
Microsoft JScript runtime error '800a01b6'
Object doesn't support this property or method
/aspforum/onetimesetup.asp, line 4
--------
<%@ Language=JavaScript %>
<%
// create the database
Server.Execute("createdatabase.asp"); //<--- line 4
// createdatabase.asp is same directory with current asp file.
OS:win98, install PWS
|
|
|
|
|
I just upgraded from XP Home to Pro and I installed IIS but there is no shortcut to it in Admin. tools. My localhost is up and IIS Admin is running as a service. Anyone know how get my shortcut so I can open the IIS snap-in?
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
Hello, I am interested in
creating a standard cookie file from
a .exe application, that will later
be consumed by a intranet
application via the ie browser.
(I'd like to be able to generate
client side cookie files without without actually
running the ie browser).
is this possible from a client side only app (.exe)?
any help is appreciated.
sas
|
|
|
|
|
I received a suggestion from another forum
to look at InternetSetCookie() et al..
looks good so far. fyi.
sas
|
|
|
|
|
Hello
Does anybody know an efficient solution for logging in ASP-WebApplications? - Means i want to log the method-call -> method-name and the time in a file.
Thanks in advance for your tipps.
Regards
pat
|
|
|
|
|
Hello,
I have written a Web-Service and an ASP.NET Client and i wanted to use the SoapLogger from . I do all the tasks quoted in this paper. (for instance copy the quoted code from this paper in my class-file.).
But when i then execute my ASP.Net Client and call a Web-Service Method, where i add the SoapLogger Attrribute in the WebService-Directive the following error occurs:
Server Error in '/ReservationClient' Application.
--------------------------------------------------------------------------------
Client found response content type of '', but expected 'text/xml'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Client found response content type of '', but expected 'text/xml'.
Source Error:
Line 515: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://unet.univie.ac.at/~a0106514/webservices/PersonLogin", RequestNamespace="http://unet.univie.ac.at/~a0106514/webservices/", ResponseNamespace="http://unet.univie.ac.at/~a0106514/webservices/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
Line 516: public string PersonLogin(string sEmailAddress, string sPassword) {
Line 517: object[] results = this.Invoke("PersonLogin", new object[] {
Line 518: sEmailAddress,
Line 519: sPassword});
Source File: C:\Inetpub\wwwroot\ReservationClient\Web References\WebService\Reference.cs Line: 517
Stack Trace:
[InvalidOperationException: Client found response content type of '', but expected 'text/xml'.
]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +1488
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +218
ReservationClient.WebService.Reservation.PersonLogin(String sEmailAddress, String sPassword) in C:\Inetpub\wwwroot\ReservationClient\Web References\WebService\Reference.cs:517
ReservationClient.Login.ImageButton1_Click(Object sender, ImageClickEventArgs e) in C:\Inetpub\wwwroot\ReservationClient\Login.aspx.cs:90
System.Web.UI.WebControls.ImageButton.onclick(ImageClickEventArgs e) +109
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +69
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1258
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
Can please anybody help me and is able to say me what went wrong??
Regards
Patrick
|
|
|
|
|
In the application, I am using two windows (parent and child). On session expiry, the child window which is the current one is redirecting the user to the login page by using the following code.
if (session("UserName") = "") then
Response.Redirect("expire.asp")
end if
At this time, I want to close the parent window. How can I do this. Please help !!
|
|
|
|
|
You can't from the server side
|
|
|
|
|
Mark is right - you'll have to have some client side javascript to take care of that parent window. A simple parent.close() should do it. (Taking that from memory - probably won't work Make sure to check if the parent window is there, otherwise you'll get an error from the login page when first going to it.
|
|
|
|
|
i'm asp developer , i recently turn into asp.net,
i face many prblems such as
on asp i can write
<%sub example(param)%>
<h1> <%=param%> </h1>
<%end sub%>
then i can use it as follows
<body>
<%example("ashraf")%>
</body>
so that it will apply the sub, can i do something like that with asp.net??
i'm using vb.net
thanx all
|
|
|
|
|
Hi,
I'm writing a credit card application and one of the things that I need to determine is if the credit card is a corporate card or a purchase card. If it is, I need to display the user another screen to capture additional information. I have a database that contains card ranges that are cards that fall into this category.
Since I've never written a Web Service, I'm not exactly sure what they are for. But I'm thinking that this is a perfect Web Service. I can load the card ranges into a table in memory and then issue a request to the Web Service to determine if this card is a corporate card. This would save a trip out to the database for every card authorization.
Is this what you use a Web Service for?
Thanks,
Glenn
|
|
|
|
|