2024

select row number pada postgresql

 select * from 

(

SELECT nim,count(*) as jml,ROW_NUMBER () OVER (ORDER BY npm) as no FROM public.data where periode='123' group by nim

) a 

 where a.no>=100 and a.no<=150


401 - Unauthorized: Access is denied due to invalid credentials.

 

401 - Unauthorized: Access is denied due to invalid credentials.


pada iis

1. silahkan jalankan IIS
2. site, nama site
3. Klik Authentication
4. Edit pada Anonymous Authentication, menjadi enabled, masukan user dan password


selesai

CS1056 Unexpected character '\0' pada visual studio 2022

 apabila mengalami error CS1056 Unexpected  character '\0'

pada saat menjalankan program di visual studio 2022

hapus folder release pada sub directory aplikasi anda.

setelah itu dicompile lagi dan dijalankan 

membuat scala Visual Studio 100%

Select Tools > Command Line > Developer Command Promp

devenv /noScale

untuk membuat scala view 100%


membuat random di MsSQL - OTP

 SELECT CAST(RAND()*100000 AS INT) as otpRANDOM;


String to Double in ASP.Net Core

string aa="3.4"

double dd= Double.Parse(aa)


show decimal or double in asp.net core

double aakhir=0; 

aakhir = Convert.ToDouble(dataReader["akhir"]);

inventory.akhir = aakhir.ToString("#,##0.00");


Replace String di ASP.Net Core

string xx="90,10";

xx=  xx.Replace(',', '.');

maka nilai variabel xx = "90.10"

menjadikan string menjadi upper pada asp.Net Core

 @p.nama.ToUpper()


ToUpper() menjadikan string besar semua.

format date in asp.Net Core

 DateTime ttgl;                            

 ttgl= Convert.ToDateTime(dataReader["tanggal"]);

TempData["tgl"] = ttgl.ToString("dddd, dd MMMM yyyy");



tampil dilayar

Monday, 22 April 2024



DateTime.Now.ToString("MM/dd/yyyy")05/29/2015
DateTime.Now.ToString("dddd, dd MMMM yyyy")Friday, 29 May 2015
DateTime.Now.ToString("dddd, dd MMMM yyyy")Friday, 29 May 2015 05:50
DateTime.Now.ToString("dddd, dd MMMM yyyy")Friday, 29 May 2015 05:50 AM
DateTime.Now.ToString("dddd, dd MMMM yyyy")Friday, 29 May 2015 5:50
DateTime.Now.ToString("dddd, dd MMMM yyyy")Friday, 29 May 2015 5:50 AM
DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss")Friday, 29 May 2015 05:50:06
DateTime.Now.ToString("MM/dd/yyyy HH:mm")05/29/2015 05:50
DateTime.Now.ToString("MM/dd/yyyy hh:mm tt")05/29/2015 05:50 AM
DateTime.Now.ToString("MM/dd/yyyy H:mm")05/29/2015 5:50
DateTime.Now.ToString("MM/dd/yyyy h:mm tt")05/29/2015 5:50 AM
DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")05/29/2015 05:50:06
DateTime.Now.ToString("MMMM dd")May 29
DateTime.Now.ToString("yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss.fffffffK")2015-05-16T05:50:06.7199222-04:00
DateTime.Now.ToString("ddd, dd MMM yyy HH’:’mm’:’ss ‘GMT’")Fri, 16 May 2015 05:50:06 GMT
DateTime.Now.ToString("yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss")2015-05-16T05:50:06
DateTime.Now.ToString("HH:mm")05:50
DateTime.Now.ToString("hh:mm tt")05:50 AM
DateTime.Now.ToString("H:mm")5:50
DateTime.Now.ToString("h:mm tt")5:50 AM
DateTime.Now.ToString("HH:mm:ss")05:50:06
DateTime.Now.ToString("yyyy MMMM")2015 May


memakai tanggal, bulan, tahun pada ASP.NET Core

     DateTime moment = DateTime.Now;

    string year1 = moment.Year.ToString();

    string month1 = moment.Month.ToString();

    string day1 = moment.Day.ToString();

    string tgll = year1 + "/" + month1 + "/" + day1;



valign pada table di asp.net core

<td style="vertical-align: middle">Test</td>

vertical-align : middle identik dengan perintah valign="center"

Menampilkan angka dengan belakang koma di Asp.Net Core

double CPLPersen= 30.10;

TempData["CPLPersen"] = CPLPersen.ToString("#,##0.00"); 




iif dalam MS-SQL

perintah IIF dalam MS-SQL


select iif(praktikum is null,'Kuliah','Praktikum')  as jenisKuliah from kuliah

artinya jika field berisi null maka jenisKuliah berisi kata Kuliah, sebaliknya jika tidak null maka berisi Praktikum



MySQL di ASP.Net Core

Install NuGet

Project - Manage NuGet

MySQL Data (Install)


Test Koneksi

using MySql.Data.MySqlClient;

MySql.Data.MySqlClient.MySqlConnection myConnection;

string myConnectionString;

myConnectionString = "server=server;uid=user;pwd=password;database=database";

try

{

    myConnection = new MySql.Data.MySqlClient.MySqlConnection(myConnectionString);

    myConnection.Open();

    MySqlCommand myCommand = new MySqlCommand();

    myCommand.Connection = myConnection;

    myCommand.CommandText = @"SELECT * FROM GudangWHERE field = @param;";

    myCommand.Parameters.AddWithValue("@param", "123445");

    using var myReader = myCommand.ExecuteReader();

    {

        while (myReader.Read())

        {

            TempData["Nama"]= myReader.GetString("nama");

        }

    }

    myConnection.Close();

}

catch (MySql.Data.MySqlClient.MySqlException ex)

{

    TempData["Nama"]= ex.Message;

}



UNIQUEIDENTIFIER With DEFAULT

 ALTER TABLE tabel123

  ADD NewColumn1 UNIQUEIDENTIFIER

  CONSTRAINT DF_T_Account_NewColumn1 DEFAULT (newid()) WITH VALUES


alter table, primary key, drop index, create index unique

 ALTER TABLE dataIABEE

ALTER COLUMN iabeeID [uniqueidentifier] NOT NULL;


ALTER TABLE dataIABEE

ADD PRIMARY KEY (iabeeID);


drop INDEX dataIABEE.idx_dataIABEE


CREATE UNIQUE INDEX idx_dataIABEE

ON dataIABEE (kode_kul,kelas,semester,fakjur);


Postingan Lebih Baru Postingan Lama