 |
|
สอบถาม Error แบบภาพนี้แก้ไขยังไงครับไม่เคยเจอ |
|
 |
|
|
 |
 |
|
@kenghockey
ถ้าผมเดาไม่ผิด พี่น่าจะอยู่แปดริ้ว
|
 |
 |
 |
 |
Date :
2019-04-12 18:51:45 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เปิด SexyDatabase.cs/vb ให้ดู
Code (VB.NET)
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SQLite
Imports MySql.Data.MySqlClient
Imports Npgsql
Imports Oracle.ManagedDataAccess.Client
'https://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/ODPNET_Core_get_started/index.html
Imports Dapper
Public Class SexyDatabase
Private Shared _dbType As sexy
Public Enum sexy
SQLServer
PostgreSQL
SQLite
MySQL
Oracle
End Enum
''' <summary>
''' กำหนดประเภท Database (SQLServer/Oracle/etc...)
''' </summary>
''' <param name="db">sexy</param>
Public Shared Sub ConfigDatabase(db As sexy)
.SetSexy(CInt(db))
End Sub
Public Shared Function SexyConnection(Optional forceOpen As Boolean = False) As IDbConnection
Dim connection As IDbConnection
'ถ้ามีการเข้ารหัส ถอก มันออกมา
'Dim strCon = Decrypt(System.IO.File.ReadAllText("Path/assFileass.txt"))
Dim strConn As String = "yes you are wonderfull to night."
Select Case _dbType
Case SimpleCRUD.Dialect.SQLServer
connection = New SqlConnection(strConn)
Case SimpleCRUD.Dialect.SQLite
connection = New SQLiteConnection(strConn)
Case SimpleCRUD.Dialect.PostgreSQL
connection = New NpgsqlConnection(strConn)
Case SimpleCRUD.Dialect.MySQL
connection = New MySqlConnection(strConn)
Case SimpleCRUD.Dialect.Oracle
Dim เแพงฉิบหาย = "Data Source=(DESCRIPTION=" _
+ "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))" _
+ "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));" _
+ "User Id=Ass1;Password=Ass2;"
connection = New OracleConnection("Data Source=localhost:1521/orcl; User Id = Ass1; Password = Ass2;")
Case Else
'Set Default to SQLServer
Dim sb = New System.Text.StringBuilder()
sb.Append("Data Source=.\sqlexpress;Initial Catalog=DBName;")
sb.Append("Integrated Security=True;MultipleActiveResultSets=true;")
connection = New SqlConnection(strConn)
End Select
If forceOpen Then
connection.Open()
End If
Return connection
End Function
End Class
|
 |
 |
 |
 |
Date :
2019-04-13 06:29:11 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
SexyConnection ไม่ได้สนใจ Simple Store Procedure/Advance Store Procedure
เด็กเด็กเด็ก เขาเล่นกัน
Code (VB.NET)
Private Sub SetupSqLite()
File.Delete(Directory.GetCurrentDirectory() & "\MyDatabase.sqlite")
SQLiteConnection.CreateFile("MyDatabase.sqlite")
Dim connection = New SQLiteConnection("Data Source=MyDatabase.sqlite;Version=3;")
Using connection
connection.Open()
connection.Execute(" create table Users (Id INTEGER PRIMARY KEY AUTOINCREMENT, Name nvarchar(100) not null, Age int not null, ScheduledDayOff int null, CreatedDate datetime default current_timestamp ) ")
connection.Execute(" create table Car (CarId INTEGER PRIMARY KEY AUTOINCREMENT, Id INTEGER null, Make nvarchar(100) not null, Model nvarchar(100) not null) ")
connection.Execute(" create table BigCar (CarId INTEGER PRIMARY KEY AUTOINCREMENT, Make nvarchar(100) not null, Model nvarchar(100) not null) ")
connection.Execute(" insert into BigCar (CarId,Make,Model) Values (2147483649,'car','car') ")
connection.Execute(" create table City (Name nvarchar(100) not null, Population int not null) ")
connection.Execute(" CREATE TABLE GUIDTest([Id] [uniqueidentifier] NOT NULL,[name] [varchar](50) NOT NULL, CONSTRAINT [PK_GUIDTest] PRIMARY KEY ([Id] ASC))")
connection.Execute(" create table StrangeColumnNames (ItemId INTEGER PRIMARY KEY AUTOINCREMENT, word nvarchar(100) not null, colstringstrangeword nvarchar(100) not null, KeywordedProperty nvarchar(100) null) ")
connection.Execute(" create table UserWithoutAutoIdentity (Id INTEGER PRIMARY KEY, Name nvarchar(100) not null, Age int not null) ")
connection.Execute(" create table IgnoreColumns (Id INTEGER PRIMARY KEY AUTOINCREMENT, IgnoreInsert nvarchar(100) null, IgnoreUpdate nvarchar(100) null, IgnoreSelect nvarchar(100) null, IgnoreAll nvarchar(100) null) ")
connection.Execute(" CREATE TABLE KeyMaster (Key1 INTEGER NOT NULL, Key2 INTEGER NOT NULL, PRIMARY KEY ([Key1], [Key2]))")
connection.Execute(" CREATE TABLE stringtest (stringkey nvarchar(50) NOT NULL,name nvarchar(50) NOT NULL, PRIMARY KEY ([stringkey] ASC))")
End Using
End Sub
Private Sub SetupMySQL()
Using connection = New MySqlConnection(String.Format("Server={0};Port={1};User Id={2};Password={3};Database={4};", "localhost", "3306", "root", "admin@1234", "sys"))
connection.Open()
connection.Execute("DROP DATABASE IF EXISTS Demo;")
connection.Execute("CREATE DATABASE Demo;")
End Using
System.Threading.Thread.Sleep(1000)
Using connection = New MySqlConnection(String.Format("Server={0};Port={1};User Id={2};Password={3};Database={4};", "localhost", "3306", "root", "admin@1234", "Demo"))
connection.Open()
connection.Execute(" create table Users (Id INTEGER PRIMARY KEY AUTO_INCREMENT, Name nvarchar(100) not null, Age int not null, ScheduledDayOff int null, CreatedDate datetime default current_timestamp ) ")
connection.Execute(" create table Car (CarId INTEGER PRIMARY KEY AUTO_INCREMENT, Id INTEGER null, Make nvarchar(100) not null, Model nvarchar(100) not null) ")
connection.Execute(" create table BigCar (CarId BIGINT PRIMARY KEY AUTO_INCREMENT, Make nvarchar(100) not null, Model nvarchar(100) not null) ")
connection.Execute(" insert into BigCar (CarId,Make,Model) Values (2147483649,'car','car') ")
connection.Execute(" create table City (Name nvarchar(100) not null, Population int not null) ")
connection.Execute(" CREATE TABLE GUIDTest(Id CHAR(38) NOT NULL,name varchar(50) NOT NULL, CONSTRAINT PK_GUIDTest PRIMARY KEY (Id ASC))")
connection.Execute(" create table StrangeColumnNames (ItemId INTEGER PRIMARY KEY AUTO_INCREMENT, word nvarchar(100) not null, colstringstrangeword nvarchar(100) not null, KeywordedProperty nvarchar(100) null) ")
connection.Execute(" create table UserWithoutAutoIdentity (Id INTEGER PRIMARY KEY, Name nvarchar(100) not null, Age int not null) ")
connection.Execute(" create table IgnoreColumns (Id INTEGER PRIMARY KEY AUTO_INCREMENT, IgnoreInsert nvarchar(100) null, IgnoreUpdate nvarchar(100) null, IgnoreSelect nvarchar(100) null, IgnoreAll nvarchar(100) null) ")
connection.Execute(" CREATE table KeyMaster (Key1 INTEGER NOT NULL, Key2 INTEGER NOT NULL, CONSTRAINT PK_KeyMaster PRIMARY KEY CLUSTERED (Key1 ASC, Key2 ASC))")
End Using
End Sub
|
 |
 |
 |
 |
Date :
2019-04-13 06:38:10 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไล่อ่านมาตั้งนาน สุดท้ายก็ ....
|
 |
 |
 |
 |
Date :
2019-04-17 17:30:12 |
By :
Luz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก #NO44 มันไม่ใช่แค่งานเดียวแต่มันหลายงาน/หลายหน้า/หลายหน้าที่ที่ต้องทำ
--- ความสนุกของผมมันไม่เหมือนเดิม แต่ก็ต้องทำเพราะว่ามันเป็นหน้าที่
--- รู้วิชาอย่างเดียวมันก็ไม่พอ มันต้องรู้หลากหลาย ทันเหลี่ยม/บิดเหลี่ยม บิดจังหวะ/บิดโอกาส รอจังหวะ/ไม่ต้องรอ etc...
ผมไม่ได้เก่งกว่าคุณ แต่ผมอายุมากกว่าคุณ และผมมีโอกาสมากกว่าคุณ ผมคิดแบบนี้นะ
|
 |
 |
 |
 |
Date :
2019-04-23 21:48:41 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมมีความสุขและสนุกที่ได้คุยกับเด็กเด็ก อย่างพวกคุณ (ผมพูด/รู้สึกอย่างนั้นจริงฯ)
|
 |
 |
 |
 |
Date :
2019-04-23 21:52:28 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
#No 44-45-46
เรื่องจริงของวันนี้เลยนะ
บรรยากาศนอกห้องประชุม (แน่นอนว่าผมออกมาสูบบุหรี่ 3 มวนติดฯกัน) ข้างในเจ้าของบริษัทก็คุยกันไป
เด็กคนที่นำเสนองานด้านเทคนิค อธิบายได้ดีเป็นฉากฯ จนผมรู้สึกว่าผมสามารถรู้กลไกอุปกรณ์เหล่านี้ได้ดีพอฯกับว่าผมสร้างมันมากับมือ
อาทิตย์หน้าผมตั้งใจว่าจะชวนเด็กคนนี้มานั่งกินไปคุยไป สาระไม่ใช่สิ่งที่สำคัญที่สุด
คนเราถ้าถูกชะตากัน ฟ้าก็ไม่อาจจะกั้นได้ เงินเดือนเป็นแสนก็มีปัญญาจ่าย
|
 |
 |
 |
 |
Date :
2019-04-23 22:22:44 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
@Luz
คุณคิดว่าอุปกรณ์ที่คุณใช้เชื่อมต่ออินเตอร์เน็ต/มือถือ ของคุณ ในเมืองไทยนี้มีกี่ยี่ห้อ
--- น้อยคนนักที่จะรู้ความลับ/กลไก การทำงานจริงฯ ในเชิงลึก ในแต่ละอุปกรณ์เหล่านั้น อทิเช่น PLC/etc...
คุณรู้ประวัติจริงฯของผมแล้วคุณจะหนาว ผมมักยกตัวอย่างภาษา VB.NET เป็นหลัก แต่ก็ไม่ได้หมายความว่าผมรักภาษานี้เป็นพิเศษ
--- กูเขียนได้ทุกภาษาและไม่ได้เขียนเหมือนพวกมึงด้วย (ผมรู้ว่า ผมใช้คำหยาบคาย)
จากที่ผมได้ไปประชุมมาเมื่อวาน ผมมั่นใจในตัวเองว่า ผมสามารถควบคุม Hardware/Software ในระดับไร้เทียมทน
องค์ความรู้และสิ่งดีดี มีอีกเยอะ บางอย่างผมก็เล่าไม่ได้
อยากจะเตือนสติ บางคนคิดว่าเป็นโปรแกรมเมอร์แล้วมันเท่ มันดี
สำหรับผม พูดได้คำเดียวว่า "ไอ้พวกโปรแกรมเมอร์ ขี้หี"
|
 |
 |
 |
 |
Date :
2019-04-24 10:43:48 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เล่าต่อ เรื่องจริงเลยนะ
เด็กเด็กเด็ก ใช้ Node Led (ตระกูล Node) นำเสนอ จังหวะที่ผมออกมาสูบบุหรี่
--- ผมขอบคุณเด็ก เขางงเลย ป๋าขอบคุณผมทำไม
--- ผมบอกว่า เผาทิ้งไปให้หมดเลย ตำรา Node Led ผมเข้าใจหมดแล้ว (เด็กคนนั้นงง ผมใช้เวลาแค่หำหลับ ก็เข้าใจทุกฯสิ่ง)
|
 |
 |
 |
 |
Date :
2019-04-24 10:54:15 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไอ้เด็กคนนี้มันฉลาดมาก มันยิ้มและย้ำพดย้ำทำอยู่อย่างนี้น (ผมแอบชื่นชมเด็กคนนี้อยู่ในใจ)
--- ผมแอบเห็นแว๊บฯ มันใช้ PHP, Node, Node Led, Grafana, InfluxDB, Google Clund, etc..
--- พี่สอน .NET Core ให้ผมด้วยนะ บางครั้งมันก็อุทานว่า ไอ้เหี้ยพี่ครับ ทำได้อย่างไรว่ะ
--- ผมเลยบอกคำสั้นฯไปว่า โรงพยาบาล/มหาวิทยาลัย มันคือดินแดนสนธยา
------ กูไม่คิดจะเสาะแสวงหาในนั้น
ปล. เขียนโปรแกรมเก่ง มันจะทำอะไรได้ดีไปว่าคำว่า กระหรี่
|
 |
 |
 |
 |
Date :
2019-04-24 11:02:11 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ก็อย่างว่านะ โอกาสของคนมันไม่เหมือนกัน บางคนทั้งชีวิตสำผัสแต่อุปกรณ์ราคาถูกฯ ไม่กี่ร้อยบาท อทิเช่น
--- Audino/PI/etc... หลักคำหำ/คลำหำ เขียนโปรแกรมตามมีตามเกิด
------ เขียน If ได้นี่แม่งท้องทั้งสำนักงาน
การเชื่อมต่อจริงบนอุปกรณ์หลักแสน และใช้งานจริง น้อยคนนักที่จะได้สำผัสกับมัน
|
 |
 |
 |
 |
Date :
2019-04-24 11:20:20 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
บางครั้งบางคราวบางคนอาจจะต้องสะอึก อิ่มกับบุญเก่า
ก็บอกแล้วว่า โลกโปรแกรมมิ่งมันเปลี่ยนไป มันจะแยกเป็นสองฝั่ง (เพื่อผลประโยชน์)
------ Gateway ระดับ Hardware
------ Gateway ระดับ Software
...
...
...
คันหำยิกยิกยิก อยากเล่าต่อ
|
 |
 |
 |
 |
Date :
2019-04-24 11:45:01 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
@Chaidhanan สหายที่รู้ใจสายเมา
+55555
หัวข้อกระทู้นี้ #133510 "[.NET] เรียกใช้ Class อย่างไร เพื่อให้ง่ายต่อการทำ CRUD (C#,EF,SQL)"
ผมบอกไปหมดแล้ว Dapper/Simple.CRUD --> .NET Core >=2.2
--- มันมีอีกหลายฯ กรณีที่ EF >=6 ยังไม่ตอบโจทย์ โดยเฉพาะ SQL Query ที่ซับซ้อน
ผมยกตัวอย่าง VB.NET ก็ไม่ได้หมายความว่าผมไม่ได้สนใจภาษา C#
Code (VB.NET)
''' <summary>
''' Usage: https://localhost:6969/api/Sura/getAllOilType
''' </summary>
''' <returns>List of (Id, Text, Remark[ล) From id_wh_tank/id_province (ตาราง คลังน้ำมัน/จังหวัด)</returns>
<Route("GetAllWarehouseTank")>
<HttpGet>
Public Function GetAllWarehouseTank() As IActionResult
Dim strSQL =
<Suparuck>
select wh_code, comp_code, id_warehouse.province_code, thai_name,thai_sname,eng_name,eng_sname,wh_type,
address_1,address_2,address_3,zip_code,contact,tax_no,tel_no,id_warehouse.server,
id_province.province_name ,id_province.region_code
from id_warehouse
left join id_province on id_warehouse.province_code = id_province.province_code
</Suparuck>
Dim results As IList(Of Object) 'IEnumerable(Of Object) '***** สำหรับ Dapper IList(Of Object) <> IList(Of Object)()
Dim fakeList = {New With {.Id = "", .Text = "", .Remark = "", .Remark2 = ""}}.Take(0).ToList()
SexyDatabase.ConfigDatabase(SimpleCRUD.Dialect.MySQL)
Using cn = SexyDatabase.SexyConnection()
results = cn.Query(Of Object)(strSQL.Value)
End Using
For Each r In results
Dim fields = DirectCast(r, IDictionary(Of String, Object)) 'row.Cast<IDictionary<string, object>>()
Dim f1 = If(Convert.IsDBNull(fields("wh_code")), "", fields("wh_code").ToString())
Dim f2 = If(Convert.IsDBNull(fields("thai_name")), "", fields("thai_name").ToString())
Dim f3 = If(Convert.IsDBNull(fields("thai_sname")), "", fields("thai_sname").ToString())
Dim f4 = If(Convert.IsDBNull(fields("eng_name")), "", fields("eng_name").ToString())
Dim f5 = If(Convert.IsDBNull(fields("eng_sname")), "", fields("eng_sname").ToString())
Dim f6 = If(Convert.IsDBNull(fields("province_name")), "", fields("province_name").ToString())
fakeList.Add(New With {.Id = f1, .Text = f2, .Remark = f1 + f2 + f3 + f4 + f5 + f6, .remark2 = f3})
Next
Return Ok(fakeList.ToList()) 'มันแปลง Property เป็นอักษรตัวเล็กทั้งหมด เช่น id, text, remark, remark2 (ดีเหมือนกันว่ะเฮ้ย)
End Function
|
 |
 |
 |
 |
Date :
2019-04-25 19:24:34 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2019-04-25 19:37:44 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คนเมาและไร้สติมันคิดวันมะรืนไม่ได้
ไม่ได้มอง 5 G แต่ผมมองไปถึงโน่น จีเหอ (10 G)
--- ลองคิดดูเล่นฯ ดึงข้อมูลทีหลักร้อยล้านระเบียน พอฯกับงานธนาคาร
------ ใช้เวลาเกิน 2 วินาทีก็ถือว่าแย่แล้ว (ห่วยแตก)
ทุกฯองค์ความรู้ ไม่มีอยู่ในตำรา ปัจจุบัน (คิดใหม่/ทำใหม่)

|
 |
 |
 |
 |
Date :
2019-04-25 19:53:33 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แน่นอนว่า Board/Censor/etc... ทำเองทั้งหมด ราคาแพงมากมากมาก เซ็นเซอร์ตัวหนึ่งก็หลักแสนบาทแล้ว
--- ราคาหลักพัน/หลักหมื่น ไม่มี
--- base64 ก็ยังไม่พอ เก็บเป็น Hex ห่อหุ้มด้วย base64 ถอดออกมาเป็นฐานสิบ และถอดแล้วถอดอีก
------ ยากมากฯที่จะเข้าถึงข้อมูลได้ในระดับ Hardware/Software องค์ความรู้ทั่วไป ไม่มีทางเข้าถึงได้
เขียน C#/VB/ภาษาเหี้ย/etc... มานานนับสิบปี ก็ไม่มีประโยชน์ ช่วยอะไรไม่ได้
|
 |
 |
 |
 |
Date :
2019-04-25 20:02:31 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
@Chaidhanan #66
มาเป็นอาจารย์ของผม/มาเป็นที่ปรึกษาของผม อายุงานไร้วันเกษียณ
--- C++/Assembly/C#/VB/PHP/Phython/etc... ผมไม่สนใจอะไรพวกนี้ เป็นหรือไม่เป็นก็มีค่าเท่ากัน
------ งานพวกนี้ให้เด็กฯทำ
|
 |
 |
 |
 |
Date :
2019-04-26 00:27:08 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไอ้เด็กบ้าฯฯฯ พวกนี้ มันจะคิด/ทำอะไรได้

|
 |
 |
 |
 |
Date :
2019-04-26 00:43:32 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|