snipt

Ctrl+h for KB shortcuts

JavaScript

jQuery Wildcard

1
2
3
4
5
$("[id$='txtcomPagerAlpha']")  //ENDS With

$("[id^='txtcomPagerAlpha']")  //STARTS With

$("[id*='txtcomPagerAlpha']") //CONTAINS
https://snipt.net/embed/51370e6b1fc4743a2125c867dab25864/
/raw/51370e6b1fc4743a2125c867dab25864/
51370e6b1fc4743a2125c867dab25864
js
JavaScript
5
2019-08-21T02:02:20
True
False
False
Apr 01, 2014 at 11:40 AM
/api/public/snipt/126495/
jquery-wildcard
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">(</span><span class="s2">&quot;[id$=&#39;txtcomPagerAlpha&#39;]&quot;</span><span class="p">)</span> <span class="c1">//ENDS With</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="nx">$</span><span class="p">(</span><span class="s2">&quot;[id^=&#39;txtcomPagerAlpha&#39;]&quot;</span><span class="p">)</span> <span class="c1">//STARTS With</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="nx">$</span><span class="p">(</span><span class="s2">&quot;[id*=&#39;txtcomPagerAlpha&#39;]&quot;</span><span class="p">)</span> <span class="c1">//CONTAINS</span> </span></pre></div> </td></tr></table>
jquery, wildcard

SQL

SQL Alter Column Type

ALTER TABLE [MYDATABASE].[dbo].[MYTABLE] 
ALTER COLUMN UserName varchar(100)
https://snipt.net/embed/e0e7f5de4c4554ad4b1e7d3537cbce01/
/raw/e0e7f5de4c4554ad4b1e7d3537cbce01/
e0e7f5de4c4554ad4b1e7d3537cbce01
sql
SQL
2
2019-08-20T01:53:45
True
False
False
Mar 03, 2014 at 10:39 AM
/api/public/snipt/118351/
sql-alter-column-type
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">ALTER</span> <span class="k">TABLE</span> <span class="p">[</span><span class="n">MYDATABASE</span><span class="p">].[</span><span class="n">dbo</span><span class="p">].[</span><span class="n">MYTABLE</span><span class="p">]</span> </span><span id="L-2"><a name="L-2"></a><span class="k">ALTER</span> <span class="k">COLUMN</span> <span class="n">UserName</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span> </span></pre></div> </td></tr></table>
sql, sql-change-column

SQL

SQL Add Column with Foreign Key

1
2
3
4
5
6
7
ALTER TABLE [MY_DATABASE].[dbo].[MYTABLE]
ADD 
ServiceType int FOREIGN KEY REFERENCES [ServiceType](Id),
Workstation varchar(50),
RegisteringStaffMember varchar(10),
Notes varchar(250)
;
https://snipt.net/embed/4e02071783cf6b839c173f568a907bd2/
/raw/4e02071783cf6b839c173f568a907bd2/
4e02071783cf6b839c173f568a907bd2
sql
SQL
7
2019-08-14T20:34:12
True
False
False
Feb 27, 2014 at 08:53 PM
/api/public/snipt/117466/
sql-add-column-with-foreign-key
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">ALTER</span> <span class="k">TABLE</span> <span class="p">[</span><span class="n">MY_DATABASE</span><span class="p">].[</span><span class="n">dbo</span><span class="p">].[</span><span class="n">MYTABLE</span><span class="p">]</span> </span><span id="L-2"><a name="L-2"></a><span class="k">ADD</span> </span><span id="L-3"><a name="L-3"></a><span class="n">ServiceType</span> <span class="nb">int</span> <span class="k">FOREIGN</span> <span class="k">KEY</span> <span class="k">REFERENCES</span> <span class="p">[</span><span class="n">ServiceType</span><span class="p">](</span><span class="n">Id</span><span class="p">),</span> </span><span id="L-4"><a name="L-4"></a><span class="n">Workstation</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">50</span><span class="p">),</span> </span><span id="L-5"><a name="L-5"></a><span class="n">RegisteringStaffMember</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">10</span><span class="p">),</span> </span><span id="L-6"><a name="L-6"></a><span class="n">Notes</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">250</span><span class="p">)</span> </span><span id="L-7"><a name="L-7"></a><span class="p">;</span> </span></pre></div> </td></tr></table>
sql, sql-add-column

SQL

SQL Create Table w/ Primary Key

1
2
3
4
5
6
CREATE TABLE [MY_DATABASE].[dbo].[MY_TABLE]
(
Id int IDENTITY(1,1) PRIMARY KEY NOT NULL,
Code varchar(100),
Description varchar(255)
);
https://snipt.net/embed/b1f6667e7319aa3b91cbd395de7e56a7/
/raw/b1f6667e7319aa3b91cbd395de7e56a7/
b1f6667e7319aa3b91cbd395de7e56a7
sql
SQL
6
2019-08-15T13:41:54
True
False
False
Feb 27, 2014 at 08:51 PM
/api/public/snipt/117465/
sql-create-table-w-primary-key
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="p">[</span><span class="n">MY_DATABASE</span><span class="p">].[</span><span class="n">dbo</span><span class="p">].[</span><span class="n">MY_TABLE</span><span class="p">]</span> </span><span id="L-2"><a name="L-2"></a><span class="p">(</span> </span><span id="L-3"><a name="L-3"></a><span class="n">Id</span> <span class="nb">int</span> <span class="k">IDENTITY</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span> <span class="k">PRIMARY</span> <span class="k">KEY</span> <span class="k">NOT</span> <span class="k">NULL</span><span class="p">,</span> </span><span id="L-4"><a name="L-4"></a><span class="n">Code</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">100</span><span class="p">),</span> </span><span id="L-5"><a name="L-5"></a><span class="n">Description</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">255</span><span class="p">)</span> </span><span id="L-6"><a name="L-6"></a><span class="p">);</span> </span></pre></div> </td></tr></table>
sql, sql-create-table

C#

C# Hashtable

1
2
3
4
5
6
//Creating the hashtable
Hashtable parameters = new Hashtable();
parameters.Add("key", "value");

//Reading the hashtable
string mystring = parameters["key"];
https://snipt.net/embed/183f7e23a92ab924fbeae12694963b55/
/raw/183f7e23a92ab924fbeae12694963b55/
183f7e23a92ab924fbeae12694963b55
csharp
C#
8
2019-08-19T03:05:14
True
False
False
Feb 22, 2014 at 03:41 PM
/api/public/snipt/115998/
c-hashtable
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">//Creating the hashtable</span> </span><span id="L-2"><a name="L-2"></a><span class="n">Hashtable</span> <span class="n">parameters</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Hashtable</span><span class="p">();</span> </span><span id="L-3"><a name="L-3"></a><span class="n">parameters</span><span class="p">.</span><span class="n">Add</span><span class="p">(</span><span class="s">&quot;key&quot;</span><span class="p">,</span> <span class="s">&quot;value&quot;</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="c1">//Reading the hashtable</span> </span><span id="L-6"><a name="L-6"></a><span class="kt">string</span> <span class="n">mystring</span> <span class="p">=</span> <span class="n">parameters</span><span class="p">[</span><span class="s">&quot;key&quot;</span><span class="p">];</span> </span></pre></div> </td></tr></table>
hashtable