📄 music.java
字号:
package MusicSky;
import java.sql.*;
import MusicSky.*;
public class Music{
protected String SongId; //音乐编号
protected String Title; //音乐名
protected float Price; //价格
protected int buynum; //购买数量
public Music(String _SongId, int _buynum) {
try
{
DBSQLManager dbsm = new DBSQLManager();
String sql="SELECT SongId,Title,Price FROM musicinfo WHERE SongId='"+_SongId+"'";
dbsm.setSqlStr(sql);
dbsm.executeQuery();
ResultSet rs = dbsm.getRs();
rs.next();
SongId = _SongId;
Title = rs.getString("Title");
Price = rs.getFloat("Price");
buynum = _buynum;
dbsm.close();
}
catch (Exception e) {
System.out.println(e.toString());
}
}
public void setSongId(String newSongId) {
this.SongId = newSongId;
}
public String getSongId() {
return SongId;
}
public void setTitle(String newTitle) {
this.Title = newTitle;
}
public String getTitle() {
return Title;
}
public void setPrice(float newPrice) {
this.Price = newPrice;
}
public float getPrice() {
return Price;
}
public void setBuynum(int newBuynum) {
this.buynum = newBuynum;
}
public int getBuynum() {
return buynum;
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -