Jump to content

Yahweh

Members
  • Posts

    186
  • Joined

  • Last visited

Posts posted by Yahweh

  1. Wow, thats very good information. I am having trouble learning how to get into my database and such, like how to get people to sign up and create there own names. I mainly have trouble with it cuz i am unsure of how to code it correctly, but thats a whole nother problem :) thanks for your help on this one.

    If you need help on Login/Signup pages, let me know, and I can certainly help you out on them :)
  2. I used the above code and I modified some places like the adopenstatic and adlockoptimisitc becoz it is not letting me update and getting an error message such as "Arguement are not same or in conflict to each other"...The above code works fine sending the info into the database but at resultpage.asp, it is not passing still.

    Jojay, theres nothign wrong with the code I wrote, because its a copy/paste from one my own sites. However I made the presumption that you were using ADOVBS.inc (most ASP programmers include that file at the top of their pages by default). Without that file, ASP won't recognize some of the constants like AdUseClient and so on.See 4GuysFromRolla FAQ - ADOVBS.inc, its a good thing to get in the habit of using ADOVBS.inc. Just copy this text file to your root directory (save it as adovbs.inc or adovbs.asp), and add <!--#include file="adovbs.inc"--> to the top of any page that uses ADO, and then the code I wrote above will work.
  3. Belzar,VBScript as a client-side language is browser specific, it only works on IE. However, client-side VBScript is dead, NO ONE uses anymore. To get a password box that works on all browsers, you have to convert your script to client-side Javascript.However, there is a significant problem with using client-side scripts to password protect pages, namely on the basis that they don't protect anything at all. Anyone can view the source of your page and see everything you've written.Here are 2 ways to password protect pages, but here's a simpler ASP-specific way:

    <%Dim strPasswordstrPassword = request("password")if Password = "baby" then%>    The rest of your page contents should go here.<%else%>    <form action="<%=Request.ServerVariables("SCRIPT_NAME")%>"    method="post">        What's the password:<br>        <input type="password" name="password">        <p>        <input type="Submit" value="Go!">        </p>    </form><%end if%>

    Using this code, no one can see any code they shouldn't when they view your source.Alternatively, I like to use this method on my sites:Login.asp:

    'You should always use a function like the one below to protect'against SQL injectionFunction SQLSecurity(strString)    SQLSecurity = replace(strString, "'", "\'", 1, -1, vbBinaryCompare)End FunctionSub Login    Dim Conn, RS, SQL, Redirect    Redirect = True        Conn = Server.CreateObject("ADODB.Connection")    RS = Server.CreateObject("ADODB.Recordset")    sql = "SELECT Count(*) as Count FROM my_table WHERE Username = " & _            "'" & SQLSecurity(Request.Cookies("Username")) & "' " & _            "AND Password = '" & SQLSecurity(Request.Cookies("Password")) & "';"        Conn.Open my_connection_string    RS.Open sql, Conn, 1, 1        if RS("Count") then            Redirect = False        end if    RS.Close    Conn.Close    set conn = nothing    set rs = nothing    if Redirect = True then    'if a valid username and password is not found        response.redirect "error.asp"    end ifEnd Sub

    On any other page, all I have to do is insert the following two lines at the top of any page:

    <!--include file="login.asp"-->Call Login... rest of page goes here ...

    If the user is not logged in, then he or she is automatically redirected to an error.asp page. Otherwise, the page loads as normal.

  4. Jojay,Notice the code that you are using in result.asp:

    response.redirect("resultpage.asp?CID = " & New_id)
    And compare it to the code you're using in resultpage.asp:
    CID = request.querystring("new_id")
    The querystring you're sending and the querystring you're requesting don't match. Use this instead:
    [results.asp]response.redirect("resultpage.asp?CID=" & New_id)[resultpage.asp]CID = request.querystring("CID")

    By the way, you can get the ID of the last inserted query without having to execute another query like this:

    Dim Conn, RS, SQL, LastInsertedIDSet Conn = Server.CreateObject("ADODB.Connection")Set RS = Server.CreateObject("ADODB.Recordset")Conn.Open your_connection_string	rs.CursorLocation = AdUseClient	sql1 = "Select * From Your_Table Where 0=1"	rs.Open sql1,conn, adOpenStatic, adLockOptimistic   RS.AddNew  rs("Field1")	= Field1_Value  rs("Field2")	= Field2_Value  rs("Field3")	= Field3_Value  rs("Field4")	= Field4_Value  rs("Field5")	= Field5_Value  RS.Update  LastInsertedID = rs("CID")	RS.closeConn.Closeresponse.redirect "resultpage.asp?CID=" & LastInsertedID

    After you update your record, and before you close your record, you can assign a LastInsertedID = rs("ID") to get the ID of the field you've just inserted, without having to execute another sql statment.

  5. Hello Everyone, Quick question but i'm getting data from a db and putting it onto a ASP page. The db data is in the form of currency but the data put on the page goes back to the form of normal number. Someone told me about ASCII codes or summin to solve this problem but i don't really know how to go about implementing this. Any Ideas? Anyone! Anyone! :)

    Its a datatyping issue. VBScript has a tendency to cast variables in the most convenient type with the narrowest bytes, and an integer datatype is about half the bytes as a currency datatype.If you store your database value in another variable, explicitly convert it to a string or a double:
    Dim myPricemyPrice = cdbl(RS("Price"))'alternately:'myPrice = cstr(RS("Price"))

  6. dhc000531,Nothing is wrong with your server, just your code. You've misspelled your cookie. Observe:<%dim numvisitsresponse.cookies("NumVisits").Expires=date +365numvisits=request.cookies("NumVists")Response.Write("This is a test on initial times of Visits:" &numvisits)If numvisits=" " thenresponse.cookies("NumVisits")=1response.write("Welcome! This is your first time to visite this page")elseresponse.cookies("NumVists") = numvisits +1Response.Write("Welcome! you have visited this")response.write("Web page" &numvisits)If numvisits = 1 thenresponse.write("time before!")else response.write("times before!")end Ifend If%>You're using "NumVists" when you should be using "NumVisits".Here is a re-write of your code:

    <%Option Explicitdim NumVisitsResponse.Cookies("NumVisits").Expires = DateAdd("m", 12, Now())NumVisits = Request.Cookies("NumVisits")Response.Write "This is a test on initial times of Visits: " & numvisitsIf cstr(numvisits) = "" then    response.cookies("NumVisits") = 1    response.write("Welcome! This is your first time to visite this page")else    response.cookies("NumVisits") = NumVisits + 1    Response.Write("Welcome! you have visited this ")    response.write("web page " & NumVisits)    If numvisits = 1 then        response.write(" time before!")    else         response.write(" times before!")    end Ifend If%>

    See a demonstration of the above code is available here:http://www.fstdt.com/scripts/cookie/visits.aspJustsomeguy,

    You can't set and retrieve a cookie on the same page, this won't work for any browser. What a cookie actually is is an http header.  The headers come before the actual page and tell the browser what character encoding, or mime type, or other properties of the page.
    That's not quite right, I set and retrieve cookies on the same page all the time.Here's an example of setting and retrieving cookies on the same page:
    <% Option Explicit %><html><head>	<title>Cookies!</title></head><body><p>This is an example of a script that sets a cookie, and retrives it on the same page. The cookie we'll be creating will be called <code>Bunny</code>. The current value of <code>Bunny</code> is:<blockquote>	<hr>	<%=Server.HTMLEncode(Request.Cookies("Bunny"))%>	<hr></blockquote></p><p><form action="default.asp" method="post">	Type a value into the textbox below. It will be used to set the <code>Bunny</code> cookie:<br>	<input name="txtCookie" type="Text" value=""><br>	<input type="Submit" value="Set Cookie"></form></p><%Dim strCookiestrCookie = Request("txtCookie")If cstr(strCookie) <> "" then    'Setting the cookie    Response.Cookies("Bunny") = strCookie    Response.Cookies("Bunny").Expires = DateAdd("m", 12, Now())%><p>Here is the new value of <code>Bunny</code>:<blockquote>	<hr>	<%=Server.HTMLEncode(Request.Cookies("Bunny"))%>	<hr></blockquote>Notice that the cookie was set and retrieved on the same page, even after the headers for the page had already been sent.</p><%End if%></body></html>

    See a demonstration of that code here:http://www.fstdt.com/scripts/cookie/default.asp

  7. I'm new in using ASP.I already create the database using microfost acces.I used 3 fields : Price, Quantity, Total.the in the web design (using dreamweaver) i create 3 textfield : price, quantity and Total.When i type the price such as $1(per unit) and quantity 3 so the total will be $3.so.how i can create the calculation and automatically its filled inside the database.i really do not know how to to do the coding.please help me... :)

    I don't recommend creating a seperate "Total" field, it creates too much overhead. Your database structure should look like this:
    your_table---------------ID (autonumber)Item (text)Price (currency)Quantity (int)

    Here is some sample data:

    ID      Item    Price   Quantity1       Cat     $12.00  112       Bunny   $6.99   133       Mouse   $3.99   454       Dog     $16.95  75       Horse   $34.99  52

    You can write an SQL statement to calculate the totals automatically, like this:

    SELECT   ID,         Item,         Price,         Quantity,         (Price * Quantity) as TotalFROM Table1;

    Use this code to display all of the records in your table, with automatically calculated Total:

    <%Dim RS, Conn, DSNName, SQLSQL = "SELECT ID, Item, Price, Quantity, (Price * Quantity) as Total FROM your_table;"DSNName = "Driver={Microsoft Access Driver (*.mdb)};Dbq=database_path;" & _          "Uid=database_username;Pwd=database_password;"  'leave these alone                                                          'if your database isn't password protectedSet Conn = Server.CreateObject("ADODB.Connection")Set RS = Server.CreateObject("ADODB.RecordSet")Conn.Open DSNNameRS.Open SQL, Conn, 1, 1%>    <table>        <tr>             <th>ID</td>             <th>Item</td>             <th>Price</td>             <th>Quantity</td>             <th>Total</td>        </tr><%    Do until rs.eof        response.write "<tr>"        response.write "<td>" & RS("ID") & "</td>        response.write "<td>" & RS("Item") & "</td>        response.write "<td>" & RS("Price") & "</td>        response.write "<td>" & RS("Quantity") & "</td>        response.write "<td>" & RS("Total") & "</td>        response.write "</tr>"        rs.Movenext    Loop%>    </table><%Conn.CloseRS.CloseSet Conn = nothingset RS = nothing%>

    The output for that script will look somewhat like this:

    ID      Item    Price   Quantity    Total1       Cat     $12.00  11          $132.002       Bunny   $6.99   13          $90.873       Mouse   $3.99   45          $179.554       Dog     $16.95  7           $118.655       Horse   $34.99  52          $1,819.48

    I don't recommend using Access databases. Use MySQL or SQL Server (if you choose to use one of those databases, then the same code above will work, only you'd have to use a different connection string).

    ASP

    what is the differences between .asp and apsx...  :)

    .asp are Classic ASP pages which are written in VBScript, and .aspx are ASP.Net which are written in VB.Net and C#. ASP.Net pages use the .Net framework and are not fully backwards compatible with Classic ASP pages.
  8. Hi all,I've written a script to move and delete files depending on the contents of them. However, everytime I tried to run the script, Permission denied mesage is throw to me. I've added this folder in program files as virtual directory in IIS and have given full access right and still no luck at all.Can anyone help me this solve this problem, please? Many thanks in advance.

    Make sure you have read and write permissions on your folders, chmod them to 660 or rw-rw--.
  9. You can't really make truly interactive games, such as a racing game or a fighting game or anything that requires the screen to react to keyboard commands. Unless you have some *very* sophisticated AJAX, all ASP processing takes place on page loads, so anytime you'd perform an action you would require a user to click a button or link to refresh the screen.At best, you could reproduce something like a Zork-styled game or an old-school Myst type game. Its possible to create board games, but reloading the screen on every move wouldn't be very fun for the user. Java and Flash are more appropriate for interactive games.

    ASP

    Why should i use ASP?Why should I use it as oppose to other languages such as PHP or JSP?Regards

    Generally, ASP is good because it makes the transition to .Net much easier. The future of web development is going to be .Net, and ASP is generally a move in the right direction if you want to transition to .Net.And in general, ASP is a more straightforward language. Its easy for humans to read, and it has a much cleaner syntax and it promotes good programming habits, at least much better than PHP. For instance, in ASP you should always use Option Explicit to force variable declaration (it also makes programs run faster), a feature lacking in PHP.In my experience, I found using regex is 1000x easier to do in ASP than in PHP. There is a single regex object, a Match and Matches collection, where all regular expressions are implemented in pretty much the same way, and they give the same output. PHP has 11 regular expression functions (ereg, ereg_replace, eregi, eregi_replace, mb_ereg, mb_ereg_replace, mb_eregi_replace, preg_match, preg_match_all, preg_replace), which are variably case sensitive or insensitive and variably return results as arrays or strings. Not fun at all. ASP.Net's regular expressions are even more powerful, especially with balanced groups and named captures (w00t!).Part of the reason why PHP has so many functions is its lack of function overloading. Rather than overload functions for case sensitive and insensitive, or better yet add an additional parameter to specify insensitivity, PHP just creates more functions. As a consequence, PHP has roughly 5000 built-in functions, compared to ASP which has around 200. PHP functions tend to have absurdly long names, averaging about 13 characters, compared to ASP whose functions tend to be around 7 characters. PHP keeps growing when they should really be focusing on creating a language that minimizes overhead, and reducing the overall number of functions to as few as needed to get the job done.Similarly, ASP's XML support is about 1000x easier to do. PHP has 31 functions for XML parsing, compared to ASP which has a single XMLDOM object and ServerHTTPXML object.A lot of people like PHP because its easy to use databases, but I didn't find that to be the case at all. There are 20 functions to connect to databases, which should be weighed against the "magic quotes" problems, and its tendency for global variables to open to script injection. ASP on the other hand other hand supports parameterized queries, rather than explicity stating SQL statements, so its much more secure and doesn't suffer from "magic quotes" when updating or adding new records.With ASP being replaced by ASP.Net, a huge problem is PHP's tendency to enforce spagetti code.I've never liked programming in PHP, its no fun at all. PHP is fine for small projects, or projects where there is relatively little intricacy. Small to medium-sized projects are ideal for ASP, and medium to industrial-sized projects are good for ASP.Net.Probably, the reason why people use PHP in first place, is that its weaknesses are made up for its price: completely free. ASP is a Windows technology, which some people consider is enough reason not to use it. Generally, however, PHP and ASP hosting is identical in terms of price and server quality.I use ASP because, above all else, I can make it do what I want much faster and much more easily.With JSP, its syntax is very similar to C#, but it just doesn't have a very large community. There are lots of PHP and ASP development communities, but not so many JSP communities. C# has really taken off, so if you'd like to use a C-like language, I recommend C#; however, you can use ASP to interpret JScript, which is to C# what ASP is to ASP.Net, although most ASP tutorials are written in VBScript rather than JScript.
  10. yep - first version of my new RSS feeder for my page is veiwable here:http://bb.1asphost.com/atkins/rss.aspjust need to move it onto the site now (its on an intranet - i just hope the server will run it: its not exactly a recent version of IIS)atm its locked on the bbc feed, but ill sort that out later

    Looks good.I'm not sure how you did your code, but here's a really simple RSS reader in Classic ASP that uses XLS transformation:http://dotnetjunkies.com/WebLog/nettricks/...02/11/6992.aspx
  11. I do not use Regex muxh, I am afraid I do not knowIt is basically saying Regex.Pattern is read only. I don't know if you can change that or not.

    No worries.I figured out a solution, but it seems odd:
    <%@ Page Language="VB" Explicit="True" %><%@ Import namespace="System.Text.RegularExpressions" %><script runat="server">    Public Function GetFileName(strString)        Dim re as Regex = New Regex("[^a-zA-z0-9]")         strString = "cache" & Re.Replace(strString, "_") & ".html"         'On the first pass, /article.asp?id=50〈=en becomes         'cache_article_aspx_id_50_lang_en.html                 re = New Regex ("_aspx")        strString = re.Replace(strString, "")         'On the second pass, cache_article_aspx_id_50_lang_en.html becomes         'cache_article_id_50_lang_en.html         GetFileName = strString    End Function    Sub Page_Load (sender as Object, e as EventArgs)         lblRegex.Text = GetFileName(request.ServerVariables("SCRIPT_NAME") &  _                                     "?" & request.ServerVariables("QUERY_STRING"))    End Sub</script><html><head></head><body>    <form runat="server">    <asp:Label id="lblRegex" runat="server" />    </form></body></html>

    That gives the results I want, but I'm not sure if its proper code. Should I be using the New keyword each time I want a new pattern? (When I omit one or both of the New keywords, I get an error.)It seems like I'm creating two seperate objects, when I only need one. My pages are heavily dependent on Regex and use dozens of different patterns to get the formatting that I want, but I'm not sure if its very good to be creating dozens of new objects (in the ASP version, I only used one Regex object and modified its .pattern property whenever I needed).

  12. use the System.Text.RegularExpressions namespace.VB
    Dim newString As String newString = Regex.Replace(originalString, "regular expression here")

    I like to reuse objects over and over, and in particular I am trying to create a Regex object whose .pattern property I can modify over and over. Here is a short script I've written:
    <%@ Page Language="VB" Explicit="True" %><script runat="server">Public Function GetFileName(strString)    Dim myRegex as Regex = New Regex("[^a-zA-Z0-9]")    strString = myRegex.Replace(strString, "_") & ".html"    'On the first pass, article.asp?id=50〈=en becomes    'article_asp_id_50_lang_en.html    myRegex.Pattern = "_asp"    strString = myRegex.Replace(strString, "")    'On the second pass, article_asp_id_50_lang_en.html becomes    'article_id_50_lang_en.html    GetFileName = strStringEnd FunctionSub Page_Load (sender as Object, e as EventArgs)    lblRegex.Text = GetFileName(request.ServerVariables("SCRIPT_NAME") &  _                                "?" & request.ServerVariables("QUERY_STRING"))End Sub</script><form runat="server"><asp:Label id="lblRegex" runat="server" /></form>

    I am converting a filename to something else for use in a cache system I'm trying to write. If a user visits the page the article.asp?id=50〈=en, then the GetFileName function converts it to "article_id_50_lang_en.html".However, after I make my first replacement, I want to change the pattern to continue doing processing to it to remove a superfluous "_asp". However, I get the following error:

    Compiler Error Message: BC30390: 'System.Text.RegularExpressions.Regex.pattern' is not accessible in this context because it is 'Protected'.Source Error:Line 7:      'article_asp_id_50_lang_en.htmlLine 8:  Line 9:      myRegex.Pattern = "_asp"Line 10:    strString = myRegex.Replace(strString, "")Line 11:    'On the second pass, article_asp_id_50_lang_en.html becomes
    How do I make my expression "unprotected", so I can modify my pattern and other regex properties?
  13. As for caching pages...I am almost positive it caches to memory, so yeah, it would not be a good idea to cache many pages for long periods of time (beyond a couple of hours).

    I suppose then I'm forced to cache files to disk by writing my own functions. So, how do I (1) read a file as ASCII text and (2) write a file to disk. :)
  14. Hi,I guess the code is going through good but I am having another error such as:Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only. I right clicked the database and checked the properties and it doesnt says Read only- the Read Only checkbox is unchecked. What is this problem? Where should I see if the database has the write permission.
    File permissions are little different on the internet, you have to make sure both your folder and database have write permissions. Right-clicking and unchecking the "read-only" box won't do anything, you have to chmod whatever folder your database is sitting in, set it to 660 (if that doesn't work, try chmodding it to 777). Most FTP programs will allow you to do that just by right-clicking on the folder and changing its permissions.If the FTP program won't let you chmod folders, then you have to ask your webhost to do it for you.
    And so, with your code, I have a question regarding the where 0 = 1" ? What does it say, is it some similar to where cssn = '"& cssn&"'
    The part that says "0=1" just tells the database not to return any rows, because you're not using them. If you excluded that part, it would force the entire table into the recordset object for no purpose (which is very resource consuming).
    And secondly, why is the rs("Cssn") = """&Cssn&""" has so many double quotes. Will this okay to use:rs("Cssn") = Request.form("Cssn")What is the difference?

    I just reproduced the same code from your opening post. When you use this:
    Insert into Cform (Cssn,Cjobno,Cfname,Clname,Cphone,Cemail,Cnotes,Cjobref,Cimmsta,Cposition) values ('"&Cssn&"', ...

    Its going to insert the "&Cssn&" into your field. You have that string surrounded in both single quotes, and double quotes. Thats just SQL, here are some more examples:

    Select "&cssn&" From some_table;-> &cssn&Select '"&cssn&"' From some_table;-> "&cssn"Select ""&cssn&"" From some_table;-> "&cssn&"Select ''&cssn&'' From some_table;-> '&cssn&'

    I put double-quotes around the values because I presumed, from your original SQL, that you wanted the string "&cssn&" inserted into your table. I'm not sure why you did, but I just reproduced the SQL code exactly as I read it. But if you were looking to insert form values and not predefined strings, then yes, you would use rs("Cssn") = Request.form("Cssn") :)

  15. Open your database and change the field called "NO OF ITEMS" to "NO_OF_ITEMS", and change "ORDER ID" to "ORDER_ID". You can't use spaces in field names.Then change this line of code:

    rs.Fields("NO OF ITEMS") = totalitmes

    To this:

    rs.Fields("NO_OF_ITEMS") = totalitems

    Change the corresponding rs.Fields("ORDER ID") lines to rs.Fields("ORDER_ID").And here's one more suggestion just to improve performance. Change this line:

    SQL= "SELECT * FROM ORDER_HEAD;"

    To this:

    SQL= "SELECT * FROM ORDER_HEAD WHERE 0=1;"

    The first select statement gets all the records in all the fields from your table and crams it into a Recordset object, but you aren't using any of those records. With the new SQL statement, you're not returning any records (you don't have to), so you'll have faster execution. You can still add new records just like before, but now you'll just be doing it faster.

  16. i have used php to get the contents of a file stored on another server - i am trying to do the same thing in asp but i cant figure out how. my aim was to get teh contents of remote xml files and then parse them using another script i have written but i cant get the file contents in the first place

    This is actually pretty easy:
    Dim objXMLHTTP, xml, strText'Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")xml.Open "GET", "http://www.targetsite.com/somefile.xml", falsexml.SendstrText = xml.ResponseTextResponse.write(strText)Set xml = Nothing

    Alternatively, you can use this:

        dim xmlDoc, isValid, strText    set xmlDoc = server.createObject("Microsoft.XMLDOM")    xmlDoc.async = false    xmlDoc.load xmlPath    isValid = cBool(xmlDoc.parseError.errorCode = 0)    if not isValid then        response.write "Invalid XML file!" & vbNewline & _               "File: " & xmlDoc.parseError.url & vbNewline & _               "Line: " & xmlDoc.parseError.line & vbNewline & _               "Character: " & xmlDoc.parseError.linepos & vbNewline & _               "Source Text: " & xmlDoc.parseError.srcText & vbNewline & _               "Description: " & xmlDoc.parseError.reason    End if    strText = xmlDoc    set xmlDoc = nothing

    ASP also has functions that will parse XML automatically for you, if you'd like to use them. See this tutorial.

  17. Anyone interested in building a normal database search engine that searches an MS-ACCESSe-mail me at: zeidhaddadin@gmail.com

    These are really simple. Its a simple SELECT statement using the Like keyword:
    Select ID, Name, [i]other columns[/i] FROM your_table WHERE Name Like "%something%";

    That will search through your database for all rows where the Name field contains the word "something". The %'s are wildcard characters.I don't know if you MS Access has this feature, but in MySQL and MS SQL you can also execute regular expressions in almost exactly the same way:

    Select ID, Name, [i]other columns[/i] FROM your_table WHERE Name regexp "something";

    Using the "regexp" operator, you don't need the %'s. However, you can do much more sophisticated pattern matching. See MySQL pattern matching (note: MySQL doesn't strictly follow regex standards, it has its own syntax that differs slightly from other regex engines).

  18. I have been trying this code for a while now.... but it isnt working for me... I am thinking that it could possibly be this part of the code I may be having a problem with, but I am not sure.<code>DSNName = "DRIVER=Microsoft Access Driver (*.mdb);DBQ="DSNName = DSNName & Server.MapPath("db/mydb.mdb")      'The "&" symbol is a way ofDSNName = DSNName & ";PWD=mypass"                      'joining, or contatenating                                              'two strings together.'Now we are going to create our objects:Set Conn = Server.CreateObject("ADODB.Connection")Set RS = Server.CreateObject("ADODB.Recordset")Conn.Open DSNName</code>The thing is that I wrote all that code out as I was supposed to, but for some reason, it does not generate a page. And the one where you write what you want to write, there is no submit buttons, so it won't work. Still looking for help please.Also, if it helps, I am using IX Webhosting. Which my database is MySql. I am having so much trouble with this.

    There was nothing wrong with the code I wrote (except forgetting a submit button, oop :) ). Its just the DSNName variable thats wrong, because you're not using an MS Access database, you are using a MySQL database, so you need a different connection string.In the default.asp and post.asp pages, change this code:
    DSNName = "DRIVER=Microsoft Access Driver (*.mdb);DBQ="DSNName = DSNName & Server.MapPath("db/mydb.mdb")      'The "&" symbol is a way ofDSNName = DSNName & ";PWD=mypass"                      'joining, or contatenating                                              'two strings together.

    To this:

    DSNName = "PROVIDER=MSDASQL;driver={MySQL ODBC 3.51 Driver};server=localhost;option=18475;uid=your_username;pwd=your_password;database=your_database;"

    Here is a ZIP file of .asp pages you need:http://www.fstdt.com/guestbook/default.zipHere is working version of the script above:http://www.fstdt.com/guestbook/default.aspHere is the SQL command you need to execute to create the structure for your table:

    CREATE TABLE `guestbook` (  `ID` int(11) NOT NULL auto_increment,  `Author` varchar(25) default NULL,  `Content` text,  `Posted` datetime default NULL,  PRIMARY KEY  (`ID`)) TYPE=MyISAM;

  19. I am having trouble with putting a comment box on my blog, hosted by blogger.com. Do I need to do something special or buy domain space for that?

    What do you mean by "comment"? Do you mean an <!-- HTML comment --> or an 'ASP comment?I've never used Blogger.com, but I'm willing to be the problem is being caused by the Blogger.com software HTML-encoding all of the characters. It causes this code:
    <!-- comment -->

    to become this code:

    <-- comment -->

    If you can see the <'s and >'s that you're typing, then thats definitely the cause of the problem, and theres no way to work around it.------Forget everything I said above. I missed the word "box" when I read the opening post the first time.Blogger.com has a built-in commenting system, however I've never used it so I'm not sure how to put comment systems on their site. I wouldn't think they'd expect you just to program your own comment system, you would probably have better luck troubleshooting your problem by going through the Blogger.com FAQ or chatting with the Blogger.com community.

  20. If its not a permission problem, its probably a cursortype or locktype problem. This code explicitly specifies to the database that you are going to be updating records:

    Set con = Server.createobject("Adodb.Connection")con.open"dsn=Candidate"Set rs = Server.createobject("Adodb.Recordset")rs.Open "Select Cssn,Cjobno,Cfname,Clname,Cphone,Cemail,Cnotes,Cjobref,Cimmsta,Cposition From CForm Where 0=1", con, 3, 3   rs.Addnew   rs("Cssn") = """&Cssn&"""   rs("Cjobno") = """&Cjobno&"""   rs("Cfname") = """&Cfname&"""   rs("Clname") = """&Clname&"""   rs("Cphone") = """&Cphone&"""   rs("Cemail") = """&Cemail&"""   rs("Cnotes") = """&notes&"""   rs("Cjobref") = """&Cjobref&"""   rs("Cimmsta") = """&Cimmsta&"""   rs("Cposition") = """&Cposition&""   rs.Updaters.closeCon.close

  21. I have a pretty good background of web design (Illustrator, photoshop, flash, etc..).  However, I don't know the first thing about programming.  I thought about going back to school to become a developer/programmer but I'm wondering if there is a different route.  If someone like myself wanted to learn programming with zero background knowledge, where should I start?

    More than anything, you should go to your library and pick up a books on programming, then you can work on teaching yourself.If you don't know HTML, I recommend picking up HTML 5.0 by Elizabeth Castro. HTML is effortless to learn, because its not a programming language, its purely text-formatting (like using BBCodes, but with more options). You can learn HTML in about 2 or 3 days, and become completely fluent in the language after a week. Putting together HTML pages is really simple, the hard part is learning how to design attractive websites.If you already know HTML, then you can move on to server-side languages, such as ASP, ASP.Net, or PHP. I personally recommend ASP or ASP.Net (and probably, out of those two, I recommend ASP.Net as the whole field of web development is moving in the .Net direction, with emphasis on classic ASP diminishing everyday). PHP is alright, but C-like languages aren't the easiest for beginners, and PHP really doesn't have as much power as ASP.Net.I recommend the following:Sam's Teach Yourself ASP.Net in 24 Hours by Scott Michell, which is a good introduction of server-side programming, databases, and web design.ASP.Net Tutorial from Macon State University. Its quite verbose, but you'll learn a lot very quickly.
  22. Sir,I have a created a projt in asp,(in java script)where u have a delete buttons .My problem z whenever i click that button the relevant data is not getting deleted but its getting displayed in the list.I need a solution for deleting that particular record in the asp page that should not affect in the database...

    First, display your records, and be sure when you click the delete button, you pass the record's unique ID as querystring data:
    Dim Conn, RS, sqlConn = Server.CreateObject("ADODB.Connection")RS = Server.CreateObject("ADODB.RecordSet")sql = "Select * From your_table"Conn.Open YourDSN    rs.open sql, Conn, 1, 1,    %>    <a href="delete.asp?ID=<%=RS("ID")%>">Delete</a> Other field data here<br>    <%    RS.CloseConn.Close

    On another page, use this code to delete your record:

     Dim Conn, RS, sqlSet Conn = Server.CreateObject("ADODB.Connection")sql = "Delete * From your_table WHERE ID = " & request("ID")Conn.Open YourDSNSet RS = Conn.Execute(sql)Conn.Close

×
×
  • Create New...