Jump to content

xpriens

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by xpriens

  1. u can also add constraints to ur Db for not allowing 'Null Values',.....i.e u cannot enter any black details in the required columns......
  2. xpriens

    Prevent SQL injections?

    Jesh is right!!! The best possible way to prevent this is by using "Stored Procedures' and also check some articles on "Cross Site Scripting" and "SQL Injection".......these two are the most vulnerable attacks in Websites for SQL.......Typecasting each variable before using it in Query, and also using the Encryptor for transfering data is a good way to get into this.........
  3. Well, on wht grounds u wanna add this new table to the original query ----- wht's ur join condition........and also report the fatal error to get more insight into this.....
  4. try adding a "Ontextchanged" event handler for the textboxes or onselecteditemchange for the combobox and redirect them all to a common function........there assign a value to an invisible object........if any of the above takes place, then at the click of a button at the end, check the value of this invisible element........here u can send a popup saying "Text has been changed"...Or, u can loop in through all the elements at the button_click event, to verify if their contents has been changed or not.......both ways should work out fine......
  5. Well, i haven't worked with PHP....but can give u a code sample for ASP.Net/C# for working this out......this is for the option 1 i.e Uploading and Downloading thru Folders.....for the second option, u can cehck for the SQL Queries related to the nchar, ntext(8Kb), and image(2MB) types.....for Downloading a file string fileName = GridView2.Rows[e.NewSelectedIndex].Cells[2].Text; Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); Response.Flush(); Response.WriteFile(@"c:\TCSMSRelations\Downloads\" + ProjectName + @"\" + fileName); Response.End(); For Uploading a File FileStream newFile = new FileStream(Location of the Share in ur Site+FileName, FileMode.Create); // Get Size of file int nFileLen = FileUpload1.PostedFile.ContentLength; // Allocate a buffer for reading of the file byte[] myData = new byte[nFileLen]; // Read uploaded file from the Stream //FileDownload1.SaveAs(@"C:\MyFile"); FileUpload1.PostedFile.InputStream.Read(myData, 0, nFileLen); //newFile.InputStream.Read(myData, 0, nFileLen); // Write data to the file newFile.Write(myData, 0, myData.Length); // Close file newFile.Close(); Similarly u can workout by creating Directories to sort out data as and when required ---- to give it a more Ordered Look.......To improve on style, u can add a table in ur SQL which contains the details of the (fileName, fileType, pathOfFile, dateOfFileCreation)......this way, u can manage each file download by just looking for the file in SQL, getting the file path, and using the downstream ----- and for uploading, adding a new row to the file table with the correct DbPath.......
  6. hey why not try to write a for/while loop for the same to span across different elements var i=0;for (i=0;i<10;i++){document.write(x.childNodes.childNodes[0].nodeValue);}Also, u can check for the total childnodes and then loop in accordingly[]..hope this helps....
  7. try creating an 'id' for the body,adn then get the body element using the 'Id' ------ finally compare the innerHtml property to verify the contents have changed or not,...
  8. xpriens

    Introduction

    PL/SQL is basically a combination of SQL (Select, Update, Insert etc....) for doing a combinations of jobs....it's like writing different SQL Statements.......Even a single SQL Statement (Select * from Table) is a PL/SQL statement..........to go for more advanced versions of this, u need to get the Scripting part or more commonly known as the T-SQL portion of SQl.......this helps in linking these simple SQL Commands to perform one or more operations ------- this includes "Loop, if-else, case, ext, variables, procedures, triggers, indexes, views....etc)....
  9. hi, are u looking for the code sample wherein people can upload and downmload documents thru ur site...If so, then u can go thru two options:1. Create a share at ur wqebsite for storing, uploading and downloading files via ur WebPage2. Store the files in SQL DB and then p[rovide the uploading and downloading of file.s......for thi su can use the nvarchar, ntext, image data types.....
  10. Not sure of PHP....but in SQL u can get those by giving the top clauseSelect top 10 from Table1 order by col1 descThis gives the last ten records as per ur choice of "Order By" Column
  11. Hi u can do this by using the below code ----- this is basically a code behid in C#, but can be implemented in ASP using functions.....string[] files = Directory.GetFiles(@"Directory Path Here"); int count = 0; foreach (string file in files) { string fileName = Path.GetFileName(file.ToString()); ---- This gives the file name of all the files in this directory...... }
  12. Couldn't get u exactly.......u wanna sort the data in only a single page.....not the entire Table data....For this, u need to get the data in hand first, sort it and then add it to the GridView......in a way, before Binding your data, just sort it out.,....
  13. Hi,Use the CName as a parameter like Declare @CName varchar(50)Select @CName = CNameSELECT * FROM Users WHERE Users.Name = @CNameThis should work out and keep the ball rolling...
  14. Hi,for the Query, with "that pulls all cats with and entry in the product_category table but NO product existing in the product table.." u can use the followig SQL Statement....Select * from Category C join Products_Category PC on C.CategoryId=PC.CategoryId left outer join Products P on PC.ProductId=P.ProductIdwhere P.ProductId is Nullfor the second half, with "one that pulls all cats with NO entry in the product_category table"Select * from Category C left outer join Products_Category PC on C.CategoryId=PC.CategoryId where PC.CategoryId is Null hope this helps and solves ur problem....
  15. This can be achieved by the following,SELECT COL1, COL2, COL3 as COL4 FROM TBL1UNION ALLSELECT COL1, COL2, COL3 as COL4 FROM TBL2
×
×
  • Create New...