使用VB 6和adodb连接,当我点击搜索id时,会出现一个输入框,当它找到我想要的ID时,它会自动将该行的所有数据插入到相应的文本框中。
在这里,我的代码,在某些时候,它不起作用,我不记得错误,但是当我回到家时,我会在这里发布,谢谢你的帮助。
Private Sub cmdsearch_Click()
findemployee = InputBox("Insert Employee ID")
record.Open ("select * from employees where ID='" & findemployee & "'"), conn, 3, 3
If record.EOF Then
MsgBox "NO" & findemployee & " ID WAS NOT FOUND!", vbCritical + vbOKOnly, "Error Search"
Set record = Nothing
Else
txtemployeeid.Text = record!ID
txtlnames.Text = record!lastname
txtfnames.Text = record!Firstname
txtmnames.Text = record!middlename
cmbgenders.Text = record!gender
bdates.Value = record!birthdate
txtbplaces = record!birthplace
txtages = record!age
txtaddress.Text = record!address
cmbeducattainments.Text = record!educattainment
txtnos.Text = record!contactno
cstarts.Value = record!contractstart
cends.Value = record!contractend
Set record = Nothing
End If
End Sub
答案 0 :(得分:0)
$sth = $con->query("SELECT * FROM posts");
$sth->setFetchMode(PDO:: FETCH_ASSOC);
while($row = $sth->fetch()){
$title = $row['post_title'];
$date = $row['post_date'];
$author = $row['post_author'];
$image = $row['post_image'];
$content = $row['post_content'];
echo "<h1>" . $row['post_title'] . "</h1>";
echo "<p>Published on: " . "<b>" . $row['post_date'] , "<p>Published By: ". $row['post_author'] ."</b>" . "</p>";