Compare cert salaries and plan your next career move
RobertKaucher wrote: » I am telling you as a full-time developer who works in JavaScript, HTML, C# and other MS technologies there are too many ways for you to go wrong.
"SELECT * FROM BOOK WHERE BOOK.ISBN == ' + $isbn + '"
SELECT * FROM BOOK WHERE BOOK.ISBN == '123456'; DROP TABLE BOOK --'
RobertKaucher wrote: » This would literally take 30s in a properly configured SharePoint site. SharePoint Foundation is free and can be used with SQL Server Express (also free) why not use it?
RobertKaucher wrote: » So, just as an example... In PHP you query the DB using the following SQL "SELECT * FROM BOOK WHERE BOOK.ISBN == ' + $isbn + '" What happens when I search for : 123456'; DROP TABLE BOOK -- ? The following SQL is executed:SELECT * FROM BOOK WHERE BOOK.ISBN == '123456'; DROP TABLE BOOK --' And you are restoring from backup.
protected DataSet getData(string query, string paramName, string searchValue, SqlDbType paramType) { //Query should look like this: SELECT foo.Name, foo.Number, foo.Address FROM Foo WHERE foo.Number = @Number //Query should be built up based on input in another method and passed in //OP will need to pass in the name of the param and the sql type as well DataSet myData = new DataSet(); //This parameter object will hold the users input so they cannot escape your code and run theirs SqlParameter searchParam = new SqlParameter(); searchParam.ParameterName = paramName; searchParam.Value = searchValue; //Passed in to query as value for @Number or whatever else you name it searchParam.SqlDbType = paramType; using (SqlConnection connection = new SqlConnection(GetConnectionString())) { //Create a new command object SqlCommand command = new SqlCommand(query, connection); //Add parameter to query command.Parameters.Add(searchParam); //Declare a new adapter SqlDataAdapter adapter = new SqlDataAdapter(command); try { //Initiate sql connection connection.Open(); //Fill table adapter.Fill(myData); } catch (Exception ex) { //Handle error } } return myData; }
CarlSaiyed wrote: » Obviously this isn't perfect because I just typed it in here real quick. It would also be better if the OP could make an SP instead of ad-hoc queries for everything but it sounds like he's a beginner. We don't know if he's planning to put this on the internet or maybe just use it at home.
Compare salaries for top cybersecurity certifications. Free download for TechExams community.