Skip to main content

Posts

Status code 415 unsupported media type in web api

In my application it was an issue because client was encoding the body content.But I was not specifying the encoding or media type. I have specified and resolved the issue as below var content = new StringContent ( postData , Encoding . UTF8 , "application/json" ); httpClient . PostAsync ( uri , content );
Recent posts

Create /drop Database or Table

{CREATE | DROP} DATABASE – Used to create / alter / delete a database respectively.     Ex: create/drop database TestDB (To created or drop TestDB) {CREATE | ALTER | DROP} TABLE – Used to add / modify / remove table in a database respectively (Ex : create table TableName(ColumnName1 datatype,ColumnName2 datatype,.. as so on),alter table TableName add Column ColumnName3 datatype: drop table TableName (to drop a table)

What is key in Sql Server?

Keys are fields in a table which participate in below activities in RDBMS systems: To create relationships between two tables. To maintain uniqueness in a table. To keep consistent and valid data in database. Might help in fast data retrieval by facilitating indexes on column(s). SQL Server supports various types of keys, which are listed below: Candidate Key Primary Key Unique Key Alternate Key Composite Key Super Key Foreign Key

Different types of Keys in sql server.

Candidate Key Candidate key is a key of a table which can be selected as a primary key of the table. A table can have multiple candidate keys, out of which one can be selected as a primary key. Primary Key Primary key is a candidate key of the table selected to identify each record uniquely in table. Primary key does not allow null value in the column and keeps unique values throughout the column. In SQL Server, by default primary key creates a clustered index on a heap tables (a table which does not have a clustered index is known as a heap table). We can also define a nonclustered primary key on a table by defining the type of index explicitly. A table can have only one primary key and primary key can be defined in SQL Server using below SQL statements: CRETE TABLE statement (at the time of table creation) – In this case, system defines the name of primary key ALTER TABLE statement (using a primary key constraint) – User defines the name of the primary key Uni...

Export html table to csv using javascript

<table>     <tr><th>Name</th><th>Age</th><th>Country</th></tr>     <tr><td>MANOJ</td><td>26</td><td>INDIA</td></tr>     <tr><td>KRISHAN</td><td>19</td><td>INDIA</td></tr>     <tr><td>SUSHEEL</td><td>32</td><td>INDIA</td></tr> </table> <button onclick="Export_CSV ()">Export HTML table to CSV file</button> function download_csv(csv, filename) {     var csvFile;     var downloadLink;     csvFile = new Blob([csv], {type: "text/csv"});     downloadLink = document.createElement("a");     downloadLink.download = filename;     downloadLink.href = window.URL.createObjectURL(csvFile);     downloadLink.style.d...

Sql CharIndex Function

The CHARINDEX  function returns the starting position of the specified expression in a character string. Example: Search for "t" in string "DotNetReceipe", and return position: SELECT CHARINDEX( 't' , 'DotNetReceipe' ) AS Position;