Wednesday, May 12, 2010
SQL/PL Update Statement and Sub Update Statement Findings
Friday, March 26, 2010
How to prevent SQL Injection
How to prevent SQL Injection
Examples that will return if you have used simple query string in your application.
Fetch All:
x’ or ‘t’=’t’ --
Discover all tables
‘union select 0, id, name,0,0,0,0,0,0,0 from sysobjects where xtype = ‘U’ --
Discover all columns
‘union select 0, name,1,0,0,0,0,0,0,0 from syscolumns --
Steal DB Users
‘union select 0, uid, name, password, roles, 0,0,0,0,0,0,0 from sysusers --
Change Cell Phone Number
888-88-8888’; update authors set phone = ‘111-11-1111’ --
Drop table
888-88-8888’; drop table discounts --
Disconnect or brind SQL Server Down
888-88-8888; exec master..xp.cmdshell ‘ipconfig /release’
(note: this depends on what version of sql database you have. Will only works if allowed by the sql database on your machine)
Or to stop sql
888-88-8888; exec master..xp_cmdshell .net stop sqlserver’
To Pervent all these do one of 3 things:
1- Use Parameterized Queries by using SqlParameter calling addSqlParameter
2- Use Stored Procedure
3- Use LINQ
Thursday, February 4, 2010
How to use cursor in oracle stored procedure
create or replace PROCEDURE sp_myprocedure(p_1 IN t1.c1%Type,
p_2 IN t1.c2%Type,
p_3 IN t3.c3%Type)
AS
BEGIN
DECLARE
v_myvariable char(7);
CURSOR crs_my_cursor IS
select * from mytable1;
BEGIN
IF (NOT crs_my_cursor%ISOPEN) THEN -- IF 1
OPEN crs_my_cursor;
END IF;
FETCH crs_my_cursor into v_my_variable;
WHILE (crs_my_cursor%FOUND) LOOP
BEGIN -- begin 2
null;
----START WORKING YOUR CODE HERE..
END;
FETCH crs_my_cursor into v_my_variable;
END LOOP;
CLOSE crs_my_cursor;
EXCEPTION
when others then
rollback;
END;
END sp_myprocedure;
Tuesday, February 2, 2010
How to add jQuery Intellisense in VS 2008
create filder Scripts in your project download both files from jquery.com
add this in your masterpage head section:
<script src="/Script/jquery-1.3.2.js" type="text/javascript"></script>
<script src="Script/jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
<script language ="javascript" type="text/javascript">
$.getJSON(…this should work now..
</script>
Note that i have /Script/jquery-1.3.2.js in the first one and
second vsdoc.js has only Script/jquery-1.3.2-vsdoc.js
Note: don’t forget to add ///
in your /Script/jquery-1.3.2.js
Hope this helps!
Saturday, January 30, 2010
CSS Quick Tip – If something doesn’t look same in IE and Firefox then try this
Type in your CSS where you have that div or css style just type this:
clear: both;
and refresh your page. It should fix your overlap and in consistency in your css look.
Tuesday, January 19, 2010
Add new value in .net dropdownlist control using jQuery
Here is your jQuery code:
// first lets un-select any items that have been selected
$("select.ddlMyDropDown option:selected").removeAttr("selected");
var addvalue = ‘MyNewValue’;
$("select.ddlMyDropDown").prepend('<option selected="selected" value="' + addvalue + '">' + addvalue + '</option>');
Here is your html code:
<asp:DropDownList runat="server" ID="ddlMyDropDown" CssClass="ddlMyDropDown" ></asp:DropDownList>
<br />
<input type="text" id="addToDropDown" class="addToDropDown" visible ="false" size="1" />
Nice!
Tuesday, January 5, 2010
How to remove Team Foundation Server old source control setting from your solution
I had to change my team foundation server and the new one had different name and url.
All of my old project was not able to load back into my new TFS. So I come across this setting in :
C:\Users\loggedinusername\AppData\Local\Microsoft\Team Foundation\2.0\Cache .. make sure that loggedinusername is your user name..
look for VersionControl.config file
open in Visual Studio and make your change here under : <VersionControlServer>
-Adnan