Jump to content

Lee-yoshi

Members
  • Content Count

    28
  • Joined

  • Last visited

Community Reputation

3 Neutral

About Lee-yoshi

  • Rank
    Newbie
  1. Thanks guys, it's all been sussed now using similar to your example dsonesuk. Think I'm starting to get the hang of this JavaScript marlarky afterall :-) Thanks very much again!!
  2. Hey guys! Another stupid problem from yours truely :-( I've created a StyleSheet with a few custom paragraph styles (Such as below): p.n_textheader {font-size: 15em; font-weight: bold; margin: 0px;} The StyleSheet is linked to the .php file all fine, but how can I change the font-size element using JavaScript in my .php file? I've tried things like document.getElementById( "n_textheader" ).style.fontSize;document.getElementById( "p.n_textheader" ).style.fontSize; document.getElementById( "p" )( "n_textheader" ).style.fontSize;document.getElementByTagName( "n_textheader" ).style.fontSize; document.getElementById( "n_textheader" ).style.font-size; ...but alas, no joy :-( Any help, greatly appreciated as always :-) Thanks!
  3. Excellent! Many thanks Ingolme, you solved my problem. Now I will continue on down the path of XML and see what will break me next! Also, thanks boen_robot, no I was running in compatibility mode ('5'). My code has now been DTD'd! Cheers
  4. Thanks for the reply! No, it is IE9 actually... which probably just make things worse! *sigh* Changed it anyway, but to no avail. What do you mean by not using childNodes?
  5. I eventually got it working. Spent an evening on Google and eventually found solutions relating to downloading and installing PHP, searching for one special file that isn't normally included with the PHP install files (As is always the case!), editing and allowing PHP on my IIS, and then changing my computers settings so that notepad isn't the default program for opening .php files, IE is! Thanks for your replies. And yes, it really was that basic code Mudsaf. So infuriating that it wouldn't work. But you seem to talk like I know what i'm doing, I don't even know what apache server is so gave up reading your post there lol! Cheers everyone. Sorry for not replying sooner. Appreciate the time you've taken to reply
  6. Hi!I've just started teaching myself XML properly to store data in instead of databases (Though it seems as if databases are better at this point). Suffice to say, it's not going very well... Here is my XML code: <?xml version="1.0" encoding="ISO-8859-1"?><!-- Diary example --><diary><entry date="20,01,2012"> <from>Lee</from> <content>Learnt PHP(LF)Learnt XML</content></entry><entry date="21,01,2012"> <from>Lee</from> <content>Learnt XML and got it to work</content></entry></diary> Here is my JavaScript: <script type = "text/javascript"> xmlDoc = loadXMLDoc( "testxml.xml" ); x = xmlDoc.getElementsByTagName( 'entry' ); for( i = 0 ; i < x.length; i++ ) { document.write( x[i].getAttribute( 'date' ) + " " + x[i].nodeType ); document.write( "<br />" ); document.write( x[i].childNodes[0].nodeName + " " + x[i].childNodes[0].nodeValue + " " + x[i].childNodes[0].nodeType ); document.write( "<br />" ); document.write( x[i].childNodes[1].nodeName + " " + x[i].childNodes[1].nodeValue + " " + x[i].childNodes[0].nodeType ); document.write( "<br />" ); }</script> Here is the output (In IE): My question is... Why is it telling me that everything is null, when there's clearly text values stored in these nodes? And why is it telling me everything is an element - How do I make something a node? I'm so confused!! :-( Any help is greatly appreciated!!Thanks. [EDIT] Also, just for reference, the output in Firefox is: Why is there a difference and how can I control this??? :S
  7. Hi everybody! I just started on PHP development and decided that writing code in notepad is just not pratical anymore, havin learnt HTML & ASP in it! So I've downloaded Notepad++ as I've heard some good stuff about it. I've developed C++ applications in Visual Studio before and this seems quite similiar. I write the very basic PHP page (The first task on w3schools!), but it doesn't run - It makes my IE crash & the PHP doesn't appear in Mozilla FireFox. It is in a folder with IIS permissions, but just won't work. As both an idiot and a newbie, can someone please help me!! Please!!! Thanks.
  8. I'm trying to import an Excel spreadsheet into ASP.NET for use with updating a mySQL database. The only problem is i've scoured the internet and not been able to find out how to read an excel file in ASP.NET successfully.Here's my current code (That doesn't work!): <%@ Page Language="C#" %><%@ Import Namespace="System.Data.OleDb" %><%@ Import Namespace="System.Data" %><%@ Import Namespace="System" %><script language="C#" runat="server">public void Page_Load(object sender, EventArgs e){ string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath( Sample1.xls ) + ";Extended Properties=Excel 8.0"; // Create the connection object OleDbConnection oledbConn = new OleDbConnection(connString); // Open connection oledbConn.Open(); // Create OleDbCommand object and select data from worksheet Sheet1 OleDbCommand cmd = new OleDbCommand("SELECT * FROM [StockList$]", oledbConn); // Create new OleDbDataAdapter OleDbDataAdapter oleda = new OleDbDataAdapter(); oleda.SelectCommand = cmd; // Create a DataSet which will hold the data extracted from the worksheet. DataSet ds = new DataSet(); // Fill the DataSet from the data extracted from the worksheet. oleda.Fill(ds); // Bind the data to the GridView DataGrid1.DataSource = ds; DataGrid1.DataBind();}</script><html><head></head><body><p><asp:Label id=Label1 runat="server">SpreadSheetContents:</asp:Label></p><asp:DataGrid id=DataGrid1 runat="server"/>\</body></html> What am i missing here?Any suggestions greatly appreciated.
  9. Hi!Thanks for replying :)I have changed this slightly so that now it gets the line of data from the text file and searches for one part of it within a record of the mySQL database records. (A UID as you say)The problem is that the mySQL database is over 500,000 records big, so it can only update about 100 records before the page times out (By the time it finds one record), when the text file contains over 100,000 records!How can i alter it so that i can send multiple 'UPDATE' sql statements in ASP.NET in one go here? I've tried adjusting the sql command text so that it adds more than one UPDATE statements together (Split by a ';' character) but it just returns another error :)Originally i was going to check if a record exists and if so, check if it needs updating and then update it if so, otherwise add it. But it just seems quicker to just update the whole record when it's found, otherwise ill have to connect twice, right?Thanks ever so much for any help you can provide!! It's immensly appreciated.
  10. So if i use ASP.NET, surely it'll still have to search through the database everytime for each record, unless you mean i should get all the data from the database and put it into a big array of some kind and then compare against that?Surely it'll always be a long process.I'm struggling so much with this it's shocking
  11. Hopefully a simple question this time.I want to compare records between MySQL database & a text file (I.e. search through MySQL Database and see if the record within the text file exists, and if so, update, otherwise insert).Here is my code so far (Getting data from both MYSQL & the text file, i just don't know how to compare records between each of them???? <%@ Page Language="C#" %><%@ import Namespace="System.Data" %><%@ import Namespace="System.Data.Odbc" %><%@ import Namespace="System.IO" %><script runat="server"> void Page_Load(object sender, EventArgs e) { [MYSQL CONNECTION DATA] OdbcConnection myConnection = new OdbcConnection(ConnectionString); OdbcCommand myCommand = new OdbcCommand(CommandText, myConnection); myConnection.Open(); DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection); DataGrid1.DataBind(); myConnection.Close(); string line; ArrayList RecList = new ArrayList(); using( StreamReader TxtFile = new StreamReader( Server.MapPath("text.txt") ) ) { line = TxtFile.ReadLine(); while( line != null ) { line = TxtFile.ReadLine(); RecList.Add( line ); } } RecList.TrimToSize(); TheRecList.DataSource = RecList; TheRecList.DataBind(); }</script><html><head></head><body style="FONT-FAMILY: arial"> <form runat="server"> <asp:datagrid id="DataGrid1" runat="server" CellSpacing="1" GridLines="None" CellPadding="3" BackColor="White" ForeColor="Black" EnableViewState="False"> <HeaderStyle font-bold="True" forecolor="white" backcolor="#4A3C8C"></HeaderStyle> <ItemStyle backcolor="#DEDFDE"></ItemStyle> </asp:datagrid> <asp:datalist id="TheRecList" runat="server" cellspacing="1" cellpadding="0" gridlines="none" backcolor="black" forecolor="blue"> <ItemStyle backcolor="#DEDFDE"></ItemStyle> <ItemTemplate><%# Container.DataItem %></ItemTemplate> </asp:datalist> </form></body></html> Please please please help!
  12. For those with the same problem as me, the answer can be found here: http://www.java2s.com/Code/ASP/ADO.net-Dat...connectionC.htm
  13. I'm trying to use data from a MySQL database in ASP.NET but it just isn't working! I'm hoping someone can spot an error or two in the code below as to why i keep getting error pages I've spent ages scouring the internet for solutions but it just isn't working &/or making any sense whatsoever!The page loads upto the point i either try to open the database (DatabaseConn.Open()) or set the reader up, then it comes up with an error page stating "Server Error in '/' Application. Runtime Error" (Which doesn't make any sense to me, cos i'm still a little bit of a n00b).I have replaced the username, password & data source fields with temp names!Any feedback is much appreciated. <%@ Import Namespace="System.Data.OleDb" %><script runat="server">Sub Page_Loaddim sqldim DatabaseConndim DatabaseCommdim DataRDatabaseConn = New OleDbConnection("Provider=MySQLProv;Data Source=DSOURCE;User Id=USERNAME;Password=PASSWORD")sql = "SELECT * FROM DataB"DatabaseConn.Open()DatabaseComm = New OleDbCommand( sql, DatabaseConn )DataR = DatabaseComm.ExecuteReader()Catalog.DataSource = DataRCatalog.DataBind()DataR.Close()DatabaseConn.Close()End Sub</script><html><body><form runat="server"><asp:Repeater id="Catalog" runat="server"><HeaderTemplate><table border="1" width="98%></HeaderTemplate><ItemTemplate><tr><td><%#Container.DataItem("FIELD1")%></td><td><%#Container.DataItem("FIELD2")%></td><td><%#Container.DataItem("FIELD3")%></td></tr></ItemTemplate><FooterTemplate></table></FooterTemplate></asp:Repeater></form></body></html>
  14. So you're saying if i try to program this comparison search in Javascript (From what i gather is very similiar to C++) instead of ASP, it'll perform quicker?I have also thought about storing the data (Or even simple data such as a '0' or '1' to state whether to read or skip each record depending on whether it's found matches or not) but the problem again there is that this .txt file contain over 250,000 records, hence my horrendous problem!! The size of the array would mean it's too big to store in a cookie to save and work on between page loads. Is it possible to send an array in javascript from one page to another?And yes remvoign individual lines from a .txt file by just writing the rest of them is the only way i could think up aswell, but again it's a timely process when the .txt file is so large
  15. Yea i've already had a play with the server.timeout settings, but the problem is it only gets through about 100 record comparisons from .txt file to MySQL database, and takes many many hours to get through the entire .txt file through page refreshing :)The only real reason ASP is a requirement is because it's all i really know! Is there a better way of doing it?Or any other work arounds?Is there a way you can remove lines from a .txt file without having to rewrite the entire thing? (Thus making the file smaller and smaller to check through making it quicker every cycle) I can only find functions that skip lines and write lines.
×
×
  • Create New...