❶ sql數據查詢及顯示
您可以使用DataGridView來顯示結果,第一拖入DataGridView控制項。隨後的MessageBox.show(「驗證用戶名成功!」);
這些話來一補
DataGridView1.DataSource = ds.Tables [「用戶名」]
這樣就可以顯示
您也可以刪除一列數據獨自在一個表中,並將數據顯示在文本框
如顯示你的表第一行和數據的第一列
TextBox1.text = ds.Tables [「用戶名」]。行[0]。電池[0]。 value.toString()
❷ 如何把SQL資料庫中表的列值個數顯示在vb中text文本框中
如果你是用ADO訪問SQL,那麼可以用以下方法獲得列值個數
text1.text=rsTbale.Fields.Count
其中rsTbale是你定義的ADO的一個記錄集,並已經打開.
如果要行數
text1.text=rsTbale.RecordCount
❸ C#如何把資料庫裡面的東西讀出來,並且顯示在文本框裡面呢
第一步,先建立與資料庫的連接
第二步,在program.cs裡面寫程序
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaterDal
{
public static class SqliteHelper
{
//從配置文本中讀取連接字元串
private static string connStr = "Data Source=資料庫的名稱;Initial Catalog=SWALL;User ID=SA;Password=666";//是這個資料庫沒錯吧?
public static DataTable GetDataTable(string sql,params SqlParameter[] ps)
{
using (SqlConnection conn=new SqlConnection(connStr))
{
//構造適配器對象
SqlDataAdapter pter=new SqlDataAdapter(sql,conn);
//構造數據表,用於接收查詢結果
DataTable dt=new DataTable();
//添加參數
pter.SelectCommand.Parameters.AddRange(ps);
//執行結果
pter.Fill(dt);
//返回結果集
return dt;
}
}
}
}
第三步,在項目裡面寫程序
private void button4_Click(object sender, EventArgs e)
{
DataTable Dt = SqliteHelper.GetDataTable("select * from jjjj");
dataGridView1.DataSource = Dt;
}
}
}
private void button4_Click(object sender, EventArgs e)
{
DataTable Dt = SqliteHelper.GetDataTable("select * from jjjj");
dataGridView1.DataSource = Dt;
}
}
}
private void button4_Click(object sender, EventArgs e)
{
DataTable Dt = SqliteHelper.GetDataTable("select * from lishiji");
dataGridView1.DataSource = Dt;
}
}
}
Form1.cs項目名
private void button4_Click(object sender, EventArgs e)
{
DataTable Dt = SqliteHelper.GetDataTable("select * from jjjj");
dataGridView1.DataSource = Dt;
}
}
}
FROM2.CS項目名
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
using CaterDal;
namespace sqlssss
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DataTable Dt = new DataTable();
Dt = SqliteHelper.GetDataTable("select * from lishiji");
DgvQueue.DataSource = Dt;
}
}
}
❹ 怎樣將sql查詢的數據顯示在html網頁的文本框中,在文本框寫入修改後的
文本框內容顯示在指定地方:就是一個dom內容轉移的操作,使用Jquery獲取原生js都很好實現,配合具體js事件實現。具體操作如下:
1
2
3
4
5
6
7
8
//假定文本框的id='mytext',指定顯示區域的id='show'
//div/span/p等節點,不是文本元素
function fun(){
getEle('show').innerHTML =getEle('mytext').value;
}
function getEle(id){
return document.getElementById(id);
}
<!--button click 觸發-->
<input type='text' id='mytext'/>
<input type='button' onclick='fun();' value="button"/>
<!--input onblur 觸發-->
<input type='text' id='mytext' onblur="fun();"/>
❺ 請問下access中怎麼將SQL取得的值放入一個文本框中並同步顯示出來
set rs=conn.execute("select * from Human where [工號]='"&text1.text&"'")
if rs.eof then
msgbox("無記錄")
else
text2.text = rs("姓名")
end if
❻ C#里怎麼把SQL里的數據顯示在文本框里
第一步,先建立與資料庫的連接
第二步,在program.cs裡面寫程序
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaterDal
{
public static class SqliteHelper
{
//從配置文本中讀取連接字元串
private static string connStr = "Data Source=資料庫的名稱;Initial Catalog=SWALL;User ID=SA;Password=666";//是這個資料庫沒錯吧?
public static DataTable GetDataTable(string sql,params SqlParameter[] ps)
{
using (SqlConnection conn=new SqlConnection(connStr))
{
//構造適配器對象
SqlDataAdapter pter=new SqlDataAdapter(sql,conn);
//構造數據表,用於接收查詢結果
DataTable dt=new DataTable();
//添加參數
pter.SelectCommand.Parameters.AddRange(ps);
//執行結果
pter.Fill(dt);
//返回結果集
return dt;
}
}
}
}
第三步,在項目裡面寫程序
private void button4_Click(object sender, EventArgs e)
{
DataTable Dt = SqliteHelper.GetDataTable("select * from jjjj");
dataGridView1.DataSource = Dt;
}
}
}
private void button4_Click(object sender, EventArgs e)
{
DataTable Dt = SqliteHelper.GetDataTable("select * from jjjj");
dataGridView1.DataSource = Dt;
}
}
}
private void button4_Click(object sender, EventArgs e)
{
DataTable Dt = SqliteHelper.GetDataTable("select * from lishiji");
dataGridView1.DataSource = Dt;
}
}
}
Form1.cs項目名
1private void button4_Click(object sender, EventArgs e)
{
DataTable Dt = SqliteHelper.GetDataTable("select * from jjjj");
dataGridView1.DataSource = Dt;
}
}
}
FROM2.CS項目名
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
using CaterDal;
namespace sqlssss
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DataTable Dt = new DataTable();
Dt = SqliteHelper.GetDataTable("select * from lishiji");
DgvQueue.DataSource = Dt;
}
}
}
❼ sql語句在用查詢後怎麼時查詢的數據現實在文本框中。求解答
查詢的前提是在一個文本框中輸入查詢的條件,然後根據條件查詢並且將所獲得的數據顯示在文本框中 滿意答案偶是隊長軟體工程師|5713個滿意答案2011-10-23你需要的技術叫做數據綁定,不過你沒有說清楚你在什麼平台下開發,我們就沒辦法給你具體代碼了。 這樣:SqlConnection Conn = new SqlConnection("連接字元串");Conn.Open();SqlCommand cmd = new SqlCommand("查詢語句",Conn);textBox1.Text = cmd.ExecuteScalar().ToString();Conn.Close();
❽ vb怎麼根據excel中文本框里輸入的內容查詢sql資料庫的數據顯示在表格里
摘要 您好,vb根據excel中文本框里輸入的內容查詢sql資料庫的數據顯示在表格里,程序如下:
❾ 易語言執行SQL查詢語句後,怎麼把查詢到的欄位內容,顯示在 編輯框中呢
建議用adodb2.0
操作上是一樣的
ado資料庫.打開("連接文本",,,,)
ado記錄集.打開("查詢語句",ado資料庫,3,3,1) 'access庫建議用這種參數
日期編輯框.內容=ado記錄集.讀("日期",10) '這句就是從記錄集中讀出數據填入編輯框
❿ MFC中怎樣將SQL得到的結果付給文本框
這個關鍵就是取SQL的結果集,再將每條記錄錄入文本框即可。。
"SELECT
編號
FROM
XSB
WHERE
成績>80"是一條SQL語句,
執行之後可能返回多條記錄,m_ID不是對應的文本框的值么?
怎麼能把SQL語句直接賦給它呢?
建議查看一下MFC連接資料庫執行SQL的例子。。。