-1
我的Access數據庫中的數據是這樣的:如何計算特定的子多少次出現在數據庫
srno likes
user 1 001,002,003
user 2 001,004,005,007
user 2 001,007,009,001
etc
我要計算多少次在likes
列中的每個單獨的值,即001
,002
,等等,出現在表中。
我用這個代碼:
cnn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_Data\Acetech.mdb"))
cnn.Open()
msg = "SELECT COUNT(001) FROM (productfeedback) WHERE three like '001' OR second like '001' "
cmd = New OleDbCommand(msg, cnn)
str = cmd.ExecuteScalar()
cnn.Close()
它應該顯示001 4
:
If str Is DBNull.Value Then
Label12.Text = "0"
Else
Label12.Text = Format(CStr(TextBox2.Text)) & Convert.ToInt32(str)
End If
如何將喜歡的東西存儲在數據庫中??作爲一個字符串? –
like is in string format – megha
please help ..... – megha