|
Hi.
Im trying to learn ASP and im having problems with connecting to access databases. Ive tried to open a connection and can perform a select statement and all is well. However, when I try to update I get an error must be an updateable query. Ive tried insert and update, neither works. So I tried to open a recordset and use the .AddNew method and I get an error saying:
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
db.open "select * from user", connstr, adOpenDynamic,adLockOptimistic
(please ignore the case)
where connstr is "DSN=Test;DBQ=C:\Inetpub\wwwroot\Project2\db2.mdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"
Ive also tried not doing a select just opening user?
Im stumped can anyone help?
|
|
|
|
|
simonjackson@att.net wrote:
adOpenDynamic,adLockOptimistic
Do you have the ADOVBS.inc file included on that page, you will need that file to use those variable name associations.
If you don't have that file, you can replace set your variable adOpenDynamic = 2 and adLockOptimistic = 3
HTH
Nick Parker
|
|
|
|
|
Add
<!-- METADATA TYPE="typelib" uuid="00000205-0000-0010-8000-00AA006D2EA4" -->
at the beginning of the ASP file. Thus you will be able to use constants of ADO. This is better way than to have include to adovb.inc
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
Hi,
I need to get the IP Address of the visitor.... how can I do this using ASP?
Thanks for ur time .....
~Statbat( );
|
|
|
|
|
You want to use the Request.ServerVariables collection.
Take a look at this article for in depth information.
Jason Jystad Cito Technologies Sonork ID: Ogami(100.9918)
There ain't nothin' in this world that's worth being a snot over. --Larry Wall
|
|
|
|
|
Request.ServerVariables("REMOTE_ADDR")
See: http://www.codeproject.com/useritems/Request_server_variables.asp
FF
|
|
|
|
|
OK, this is driving me absolutely nuts, because I can find exactly NO help on it on the net. I'm trying to load in a User Control using the LoadControl method, the error that I get every time is as follows:
System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %> )
I've got the following tag at the top of my aspx file:
<%@ Reference Control="ClientInfo.ascx" %>
And my code looks as follows:
'The .vb codebehind file:
Dim C As ClientInfo1 = CType(LoadControl("ClientInfo.ascx"), ClientInfo1)
Page.Controls.Add(C)
Any ideas? Has anybody else seen this type of error before?
Thanks in advance.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
Hey,
I'm messing around with regular expressions in order to get something that will automatically convert URL's into live hyperlinks in the forums. I have the following expression:
(http|ftp|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])? which does a good job of getting URLs, but I need something that will not return a match if the URL is already enclosed in <a href=...> tags.
Any thoughts?
Those looking to play with this a little can use my online regular expression test page.
cheers,
Chris Maunder
|
|
|
|
|
Easy peasy - just put a space before it:
" (http|ftp|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?"
'cause if it's already <a href='d then you have the equals instead of the space.
HTH.
[edit]
Obviously you can extend it to check for any letter other than an '=' followed by any number of spaces, followed by the URL like you've already got(ten). I can't remember the exact syntax off hand and don't have docs handy; I hate doing regular expressions .
[/edit]
--
Andrew.
|
|
|
|
|
So what if the URL is at the beginning of a line? Or what if the URL is of the form <a href=...> www.abc.com</a>?
cheers,
Chris Maunder
|
|
|
|
|
brain not in gear... I had another bash but couldn't get it working right, so I finally decided to pass the buck.
--
Andrew.
|
|
|
|
|
Damnit Chris!!!
I took a whole 1/12th of an hour out of my schedule last night to write a JavaScript for you and you go and invalidate all of my work like this!!!! Damn you Maunder!!!!
Seriously though, I banged out a JavaScript function that will take the text in a field and wrap it in link tags and then append it to the message area. Similar to the "Quote Selected Text" button you have now.
I figured you could put another button next to the "Quote" button and a small text field next to that. Then users could paste a URL into the field in whatever form and click the button and it would process it into the message. This saves users the typing of the tags, (and makes sure that the damn target is set!!! ), but obviously the regex is the better way to go. I just figured that maybe you didn't want to add any more processing to your message parser.
This function also adds the "http://" if the user doesn't include it and if someone just clicks the button it will append a blank link tag that they can fill in themselves.
Anyhow, in case you are interested anyway I will include the function within pre tags below. Just call it from a button's onclick and make sure the text field name matches, it should be ready to go otherwise. I tried to match your existing form and field names as best I could to make it as easy to drop in as possible. Just doing my best to help out as things occur to me.
<script language="JavaScript" type="text/javascript">
<!--
function InLinkErAtor(){
var objContentText = document.MessageForm.ContentText;
var strLinkText = document.MessageForm.LinkText.value;
var strContentText = objContentText.value;
var strOutputLink = "<a href=\"";
if (strLinkText.indexOf("http://") == -1){strOutputLink += "http://"}
strOutputLink += strLinkText + "\" target=\"_blank\">" + strLinkText + "</a>";
strContentText += strOutputLink;
objContentText.value = strContentText;
objContentText.focus();
}
</script>
I'll post this in the suggestion forum where it belongs also. In the meantime I'll see if I can find my url regex from a couple of projects back in my notes anywhere and post it if it looks like it would be any help.
Thanks for all your continuing efforts Chris, we all appreciate it.
Jason Jystad Cito Technologies Sonork ID: Ogami(100.9918)
There ain't nothin' in this world that's worth being a snot over. --Larry Wall
|
|
|
|
|
Hey - nice idea. I just wanted something super easy (and transparent to the user) that I could slip in. Currently all messages are reformatted on the fly (so we can change our formatting options down the line and not lose anything) but for this I was going to modify the actual message once before storing it.
Maybe I should add an option 'InLinkErAte my message' when posting...
cheers,
Chris Maunder
|
|
|
|
|
Chris Maunder wrote:
Hey - nice idea.
Thanks, I try.
Chris Maunder wrote:
but for this I was going to modify the actual message once before storing it.
Well, that would seem to be the way to handle links to me. That is why I thought that a simple client-side JavaScript that does insertions would be cool. No extra work for your servers, and yet it still gets rid of most of the work of inserting a link for the users. And there really isn't any reason not to just store it as is then.
I admit that my idea isn't as transparent to the user as yours is, but I was honestly trying to make it so easy for you to add the feature that you wouldn't be able to resist.
Chris Maunder wrote:
Maybe I should add an option 'InLinkErAte my message' when posting...
Hm, as much as I would like to get my silly kitchen appliance pun out into public view - I think that you should just tie this into the "Display this message as-is" checkbox. If they want HTML then parse for links, if not then don't.
Jason Jystad Cito Technologies Sonork ID: Ogami(100.9918)
There ain't nothin' in this world that's worth being a snot over. --Larry Wall
|
|
|
|
|
Any further activity on this Chris?
I found my notes, they do not help with the above problem but the way I arrived at the solution to what you are doing above was slightly different. I thought I would post it, in case it helps you out or gives you some other ideas.
(ht|f)tps?:\/\/(\w+\.)+\S+
I tested it on your page to verify that it worked, and it seems to do exactly what yours does.
I will think about the above problem some more when I can and see if I can think of a solution for that.
One other thing I should point out is that this will only catch those urls that have an http:// or something in front of them, not the simple www.codeproject.com ones. I think it would be nice to catch these too.
A simple modification to catch URLs without the http:// could go like this:
((ht|f)tps?:\/\/)?(\w+\.)+\S+
Damn, now I have the itch to go write some PERL!!
Jason Jystad Cito Technologies Sonork ID: Ogami(100.9918)
There ain't nothin' in this world that's worth being a snot over. --Larry Wall
|
|
|
|
|
I messed around with it a little bit and it seems that I may have found a solution to your problem. I provided an example in perl, I don't know ASP (I came into this forum because I saw this thread discussed in the lounge).
I basically prefixed your regex with:
(^|.*?[^="'\s])\s*
It works on your example page however with a string like "test http://www.site.com test" it will match the last text before the url as well like so: "test http://www.site.com". This is why I provided the perl example below, to combat this problem. I hope this converts easily to ASP, if not let me know and I will try to think of something else.
$url = 'blah http://www.url1.com/dir/file.txt blah http://www.url2.com/dir/file.txt \'blah\'';
$url =~ s/((^|.*?[^="'\s])\s*)((http|ftp|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?)/$1<a href="$3" Target="_BLANK">$3<\/a>"/g;
print "[$url]\n";
It seems to work well, the only problem would be if someone quoted the word directly before the url like "so" http://www.url.com. Anyhow, I hope this helps out.
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
What are my options...?
Are their utility progs that would allow me to update my database sitting on a server...?
Should I use a secure login to only allow admin. certain access and change the contents of the DB...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
What kinda database you have? If it is an Access DB, look at my signature
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
I created a web service using VC++ .Net. Then created a simple Web client using ASP .Net. I added a web reference in the WebApplication project to the webservice. But when I try to test the application I get the error listed below. Not sure what I did wrong. Any ideas?
Also if I remove any calls to the Webservice then my asp page works. I believe this may have to do with setting some permission somewhere. But I seem to have done all what the limited documentation asked me to do. So not sure what I am to fix.
Thanks
***********************************************************************
Server Error in '/WebApplication1' Application.
The request failed with HTTP status 401: Access Denied.
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.Net.WebException: The request failed with HTTP status 401: Access Denied.
Source Error:
Line 40: _
Line 41: Public Function HelloWorld() As String
Line 42: Dim results() As Object = Me.Invoke("HelloWorld", New Object(-1) {})
Line 43: Return CType(results(0),String)
Line 44: End Function
Source File: e:\inetpub\wwwroot\WebApplication1\Web References\localhost\Reference.vb Line: 42
Stack Trace:
[WebException: The request failed with HTTP status 401: Access Denied.]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream)
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
WebApplication1.localhost.Class1.HelloWorld() in e:\inetpub\wwwroot\WebApplication1\Web References\localhost\Reference.vb:42
WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in e:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb:34
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
**************************************************************************
|
|
|
|
|
OK. I may have solved this. The MS documentation said that I should disable anonymous access to the web site. If I enable it my web site works. I need to read more to figure this all out.
|
|
|
|
|
I'm tired of beating my head against the wall. I've been playing with styles trying to make a simple page with a header, a left menu pane, and a main display area. It's trivial to do using frames, but I don't want to. I spent the day trying different styles to get a background picture in just the main frame, but I can't make it display anywhere but in the BODY tag. My assumption is that a DIV element can't support a background image, though the CSS-1 spec says the attribute applies to all elements. Scratch idea one.
That's acceptable, but when I add a DIV or SPAN element to contain the menu or main section, it completely blanks out the background in that region, and I can't find an off switch for that 'feature'.
I downloaded the .css file for CP, just to have a real-world example of something that works, and have been studying it this afternoon and evening, but I can't see anything I'm doing wrong from reviewing that source. The cheesy layouts and themes that come with VS are cute, but I wouldn't consider using one for anything real.
Can someone give me a clue how to get this pig started?
|
|
|
|
|
Use tables.
<table>
<tr>
<td colspan="2">
Banner that spans the top of the page
</td>
</tr>
<tr>
<td width="150">Left column (put your menu here)</td>
<td>Right column (put your main content here)</td>
</tr>
</table>
Actually, you can get much fancier than this (take a look at CP's nested tables), but this will give you the basic idea.
Jon Sagara
"Did you bring the butfor?"
"What's a butfor?"
"To poop with, silly."
|
|
|
|
|
I suppose I'll have to, arrggghhhh! I tried that once before, thinking that if I gave a NAME attribute to the central data cell I could direct new data into it from the menu by using the target= attribute, but it didn't work. I guess I'll have to use ASP to change the page and reload each time. Grumble...
Jon Sagara wrote:
"Did you bring the butfor?"
"What's a butfor?"
"To poop with, silly."
Nice one
|
|
|
|
|
Roger Wright wrote:
Nice one
South Park BLU at its finest. It's a variation of another favorite of mine from the movie "Spies Like Us":
"Did you bring the dickfer?"
"What's a dickfer?"
"To pee with."
Jon Sagara
"Did you bring the butfor?"
"What's a butfor?"
"To poop with, silly."
|
|
|
|
|
Jon Sagara wrote:
"Did you bring the dickfer?"
"What's a dickfer?"
"To pee with."
I'm sure I'll find occasion to use both!
|
|
|
|