我正在检查PostgreSQL是否可以替代SQLServer,我在PostgreSQL公共模式下的测试数据库中创建了一个测试表,并向测试表中添加了两行数据。
现在的问题是,当使用NpgSQL.dll从C#.net运行简单查询时,我得到重复的结果,但并没有显示所有表数据。
这是我使用的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using Npgsql;
namespace PlayingWithPostgres
{
class Program
{
static void Main(string[] args)
{
// creating the connection string (Server, Port, User id, password, database)
string conStr = "Server=127.0.0.1; Port=5432; User Id=postgres; Password=Sada1973; Database=CarsTestDB;";
NpgsqlConnection conn = new NpgsqlConnection(conStr);
string comStr = "Select * FROM \"CarsTable\";";
NpgsqlCommand com = new NpgsqlCommand(comStr, conn);
NpgsqlDataAdapter ad = new NpgsqlDataAdapter(com);
DataTable dt = new DataTable();
Console.WriteLine("Conection to server established …Run Code Online (Sandbox Code Playgroud) 在Unity UI中,LayoutElement具有最小,首选和固定大小,但没有max size属性。
例如,如果我有一个text1和
layoutElement.flxibleWith = 1
layoutElement.minHeight = 19
Run Code Online (Sandbox Code Playgroud)
text1 一行txt:
但是,当我在text1其中加载文本时,它的高度会无限扩展:
我已经编写了一个脚本:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
[ExecuteInEditMode]
[RequireComponent(typeof(LayoutElement))]
public class LayoutElementMaxSize : MonoBehaviour
{
private LayoutElement layoutElement;
private ContentSizeFitter contentSizeFitter;
private RectTransform rectransform;
public bool controllWidth;
public bool controllHeight;
public float maxHight;
public float maxWidth;
void Start()
{
layoutElement = GetComponent<LayoutElement>();
rectransform = GetComponent<RectTransform>();
}
public void Update()
{
if(rectransform.hasChanged)
{
rectransform.hasChanged = false;
if (controllHeight)
{
layoutElement.preferredHeight = -1;
layoutElement.CalculateLayoutInputHorizontal();
layoutElement.CalculateLayoutInputVertical(); …Run Code Online (Sandbox Code Playgroud) 我有一个带有5个文本框和一个按钮的表单,我想检查所有这些文本框是否为空或空用户输入.使用这个简单的方法:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (verifyUI() == true)
MessageBox.Show("user input for all textboxes was correct!");
else
MessageBox.Show("user input for all textboxes was missing!");
}
private bool verifyUI()
{
bool userInputOk = false;
foreach (Control cTxt in Controls.OfType<TextBox>())
{
if (string.IsNullOrWhiteSpace(cTxt.Text) || cTxt.Text == "")
{
userInputOk = false;
}
else
{
userInputOk = true;
}
}
return userInputOk;
}
}
Run Code Online (Sandbox Code Playgroud)
当我在文本框1中输入值时,该方法仅检查第一个文本框并返回true,并忽略所有其他文本框.
我确信我正在使用的方法的逻辑有问题.
哪种做法被认为是更好的做法,以及为什么它会产生什么影响:
在网页中使用特殊字符 HTML 代码(例如©为了版权)或直接使用Character Map并复制粘贴符号到页面中。
更具体地说,在什么情况下不建议使用html 文字?
c# ×3
ascii ×1
database ×1
datasource ×1
html ×1
linq ×1
markup ×1
npgsql ×1
parsing ×1
postgresql ×1