ADO GetString နည်းလမ်း
❮ ပြီးပြည့်စုံသော Recordset Object ရည်ညွှန်းချက်
GetString နည်းလမ်းသည် သတ်မှတ်ထားသော Recordset ကို string တစ်ခုအဖြစ် ပြန်ပေးသည်။ ASP ဖိုင်များတွင် HTML ဇယားများကို ဖြည့်ရန် ဤနည်းလမ်းကို အသုံးပြုနိုင်သည်။
အထားအသို
Set str=objRecordset.GetString(format,n,coldel,rowdel,nullexpr)
Parameter | Description |
---|---|
format | Optional. A StringFormatEnum value that specifies the format when retrieving a Recordset as a string |
n |
Optional. The number of rows to be converted in the Recordset |
coldel | Optional. If format is set to adClipString it is a column delimiter. Otherwise it is the tab character |
rowdel | Optional. If format is set to adClipString it is a row delimiter. Otherwise it is the carriage return character |
nullexpr | Optional. If format is set to adClipString it is an expression used instead of a null value. Otherwise it is an empty string |
ဥပမာ
မှတ်တမ်းအစုံမှဒေတာနှင့်အတူ HTML ဇယားတစ်ခုဖန်တီးရန်၊ ကျွန်ုပ်တို့သည် အထက်ဖော်ပြပါ ကန့်သတ်ချက်သုံးခုကိုသာ အသုံးပြုရန်လိုအပ်သည်-
- coldel - ကော်လံ-ခွဲထွက်အဖြစ် အသုံးပြုရန် HTML
- rowdel - row-separator အဖြစ်သုံးရန် HTML
- NullExpr - ကော်လံတစ်ခုသည် NULL ဖြစ်ပါက အသုံးပြုရန် HTML
မှတ်ချက်- GetString() နည်းလမ်းသည် ADO 2.0 အင်္ဂါရပ်တစ်ခုဖြစ်သည်။ ADO 2.0 ကို http://www.microsoft.com/data/download.htm တွင် ဒေါင်းလုဒ်လုပ်နိုင်ပါသည် ။
ဥပမာ
အောက်ဖော်ပြပါ ဥပမာတွင် ကြိုးတစ်ချောင်းအဖြစ် recordset ကို ထိန်းထားရန် GetString() နည်းလမ်းကို အသုံးပြုပါမည်။
<html>
<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT Companyname, Contactname FROM Customers", conn
str=rs.GetString(,,"</td><td>","</td></tr><tr><td>"," ")
%>
<table border="1" width="100%">
<tr>
<td><%Response.Write(str)%></td>
</tr>
</table>
<%
rs.close
conn.close
set rs = Nothing
set conn = Nothing
%>
</body>
</html>
StringFormatEnum တန်ဖိုးများ
Constant | Value | Description |
---|---|---|
adClipString | 2 | Delimits rows by the rowdel parameter, columns by the coldel parameter, and null values by the nullexpr parameter |
❮ ပြီးပြည့်စုံသော Recordset Object ရည်ညွှန်းချက်