28 lines
		
	
	
		
			863 B
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			28 lines
		
	
	
		
			863 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| 
								 | 
							
								using Microsoft.Data.Sqlite;
							 | 
						||
| 
								 | 
							
								using System;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace TestDB
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    class Program
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        static void Main(string[] args)
							 | 
						||
| 
								 | 
							
								        {
							 | 
						||
| 
								 | 
							
								            using (var connection = new SqliteConnection("Data Source=FutureMail.db"))
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                connection.Open();
							 | 
						||
| 
								 | 
							
								                
							 | 
						||
| 
								 | 
							
								                var command = connection.CreateCommand();
							 | 
						||
| 
								 | 
							
								                command.CommandText = "PRAGMA table_info(Users)";
							 | 
						||
| 
								 | 
							
								                
							 | 
						||
| 
								 | 
							
								                using (var reader = command.ExecuteReader())
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    Console.WriteLine("Users表结构:");
							 | 
						||
| 
								 | 
							
								                    while (reader.Read())
							 | 
						||
| 
								 | 
							
								                    {
							 | 
						||
| 
								 | 
							
								                        Console.WriteLine($"列名: {reader[1]}, 类型: {reader[2]}, 是否非空: {reader[3]}, 默认值: {reader[4]}, 主键: {reader[5]}");
							 | 
						||
| 
								 | 
							
								                    }
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |