Jump to content

jesh

Members
  • Content Count

    2,293
  • Joined

  • Last visited

Everything posted by jesh

  1. I'm not a VB person, but it looks like you are missing something in your code there. Where are you instantiating dbcomm? You declare it in the first line, but you never instantiate it: Dim dbconn, sql, dbread, dbcommdbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & Server.MapPath("db1.mdb"))dbconn.Open()sql = "INSERT INTO vic (user,pass,name,section,address) VALUES('" & use.Text & "','" & pass.Text & "','" & name.Text & "','" & sec.Text & "','" & adr.Text & "')"// You seem to be missing something like:dbcomm = New OleDbCommand(sql);dbcomm.Connection = dbconn;// Also, I don't think you want to run a reader on an INSERT://dbread = dbcomm.ExecuteReader()//vic.DataSource = dbread//vic.DataBind()//dbread.Close()// ----------------------------------dbcomm.ExecuteNonQuery();dbconn.Close()
  2. Javascript doesn't truly have variable types like string, int, byte, etc. All variables are of type var. So you could, technically, perform: var test = 5 / "wtf"; The value assigned to test would be "NaN", so this might help your script: <script language="JavaScript" type="text/javascript">var degFahren=prompt("enter the degrees in Fahrenheit",50);var degCent;degCent=5/9*(degFahren-32);if(isNaN(degCent)){ alert("You didn't enter a number!");}else{ alert(degCent);}</script>
  3. Try starting at http://www.w3schools.com/html/html_links.asp.
  4. jesh

    A few Questions

    W3Schools is what got me going in the realm of web development. I think it is comprehensive enough to get you a decent background and foundation.Once I went through the tutorials on javascript here, I knew enough that I could begin to decipher the code posted on sites such as Dynamic Drive.Another great resource is A List Apart.But nothing beats W3Schools for the tutorials and quick reference.-Jesh
  5. jesh

    PHP editor

    Until I moved into the Visual Studio world, I used UltraEdit and loved it. It's not free but I felt that it was worth the cost ($40 or so).
  6. Does the "Previous" link still work? I looked closer at your SQL: SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school' ORDER BY dateentered LIMIT $rownumber, $limit; Perhaps setting the $rownumbernext like the following would work: $rownumbernext = $rownumber + $limit;if($rownumbernext > ($num_rows - $limit)){ $rownumbernext = ($num_rows - $limit);} This way, if there are 50 records in your table ($num_rows) and you want to grab 2 ($limit) records per page, $rownumbernext would never get larger than 48. Clicking "Next" after that should keep the display on the last page.
  7. It sounds like you might need to determine the total number of possible pages and then when you calculate what the previous and next pages should be, you'd need to check those values against the total number of pages.My PHP is RUSTY, but something like this? $rownumberprev = $rownumber - 2;if($rownumberprev < 0){ $rownumberprev = 0;}$rownumbernext = $rownumber + 2;if($rownumbernext > $maxrows){ $rownumbernext = $maxrows;}
  8. jesh

    thumbnail images

    It would download the full image and then shrink the display of it. Depending on the size of your image files and how many you are displaying on the page at a time, it may take a lonnnnng time for the page to load for some users. However, all the images, once loaded, will be in the cache and the users wouldn't have to wait to load the individual, full-size images when they click on the links.
  9. jesh

    edit XML

    I haven't touched XML in awhile, but you might be able to use a DataSet: DataSet ds = new DataSet();ds.ReadXml("c:\\xml\\myfile.xml"); Once the data is in the dataset, you can navigate to the appropriate spot in your DataSet to change the value of the date. Once you are ready, you can write back to the xml file: ds.WriteXml("c:\\xml\\myfile.xml"); Navigating through the DataSet may take some work until you determine how .NET parses your XML file.I hope this helps!
  10. When you perform a postback on the form (by clicking on the Lookup button), the values remain in the textbox and the message remains until you reload the page from scratch. When you use your browser's refresh button to reload the page it, at least in Firefox, resubmits the page to the server. You might consider adding a "Clear" button to your form.Add this to your script: <script language="C#" runat="server">void ClearButton_Click(object sender, EventArgs e){ Response.Redirect(Request.Url.AbsolutePath);}</script> And this to your form: <asp:Button id="ClearButton" OnClick="ClearButton_Click" text="Clear Page" runat="server /> Alternatively, you could avoid adding this extra code and then just type in the address of your page in the address bar of your browser and hit ENTER to reload the page rather than clicking the refresh button.
  11. jesh

    email server

    As far as I know, IIS comes with a "Default SMTP Virtual Server" which you can use in your web applications to send emails. I've used it on a number of applications that send out a single email here and there. I haven't ever tried it with large amounts of email so I can't vouch for its ability to handle large volume. It might get you started though.
  12. Hmm. It seems I read your post wrong. I missed the part about listing2.html being a separate page and the page with the JumpMenu not having any frames - must need more coffee...The code I wrote could only work if the menu was in the same page as the iframe. Perhaps you could create a function that fires when listing2.html loads that can find the "#xxxxxx" value in the URL and then run the little script to get that value and then change the src of the iframe.I looked at "location.hash" but it appears that IE doesn't like it too much.This code worked well for me in Firefox but IE threw up all sorts of security errors... <script type="text/javscript">function init(){ var hash = location.hash; var iframe = document.getElementById("myIframe"); iframe.src += hash;}window.onload = init;</script> Try looking around at how to get values from query strings: Google Search
  13. You might consider using javascript to change the src of your iframe in your MM_jumpMenu function.For example: function MM_jumpMenu(obj){ // get the value of the select menu. var value = obj.value; // get the index of where the "#" appears in the value var idx = value.indexOf("#"); // if there is a "#"... if(idx > 0) { // get the target from the value using substr. var len = value.length; var targ = value.substr(idx, len); // change the src of the iframe to reflect the target. var myIFrame = document.getElementById('iframeid'); myIFrame.src = "test.html" + targ; } // do whatever else your MM_jumpMenu function needed to do}
  14. That while loop worked for me. Here's how you might incorporate it into your script: <script type="text/javascript"> function sendSearch(){var param1 = document.getElementById('param1');var param2 = document.getElementById('param2');var theForm = document.forms[0];// Here is where you strip the spaces and replace it with '+'s //param1.value = stripSpaces(param1.value);param2.value = stripSpaces(param2.value);theForm.action += "&searchTerm=" + param1.value + "&zipcode=" + param2.value;theForm.submit();}// Here is a new stripSpaces function using your previous code:function stripSpaces(str){ var loopProtect = 0; while(str.indexOf(" ") != -1 && loopProtect < str.length) { str = str.replace(" ","+"); loopProtect++; } return str;}</script>
  15. Instead of: str = str.replace(\ \,"+"); try: str = str.replace(" ","+"); -Jesh
  16. It doesn't look like you are binding the data to the control.I don't know about VB, but in C# you'd want to add something along the lines of: DataTable table = new DataTable();table.Load(dbread); // dbread is your SqlDataReader Once you have the datasource, you'd need to bind it to the Repeater: customers.DataSource = table;customers.DataBind(); Good luck.
  17. jesh

    DataList Help

    Hey Eric,You might try using an event handler to check whether there is novalue for ADD2 which then hides the Label for you. First, associate the event handler with your DataList: <asp:DataList ID="table" runat="server" CellPadding="2" DataKeyField="IDNumber" DataSourceID="MarketplaceData" RepeatColumns="1" GridLines="Both" RepeatLayout="table" Width = "600px" ItemStyle-Font-Bold="true" OnItemDataBound="table_ItemDataBound"> Then, in your codebehind, add something like the following: protected void table_ItemDataBound(object sender, DataListItemEventArgs e){ DataListItem item = e.Item; switch (item.ItemType) { case ListItemType.Item: case ListItemType.AlternatingItem: string strADD2 = DataBinder.Eval(item.DataItem, "ADD2").ToString(); if (strADD2 == null || strADD2 == String.Empty) { ADD2Label.Visible = false; } break; }} I hope this helps!Jesh
×
×
  • Create New...