我想在会话中记录我的表名。我可以获得有关会议的帮助吗?
random r = new Random();
int sayi = r.Next(0, 99999999);
string sayi2 = sayi.ToString();
//Create
using (MySqlConnection baglanti = new MySqlConnection("server=localhost; user id=root; password=xxxx; database=de_db; pooling=false"))
{
baglanti.Open();
MySqlCommand cmd = new MySqlCommand("CREATE TEMPORARY TABLE gecici"+ sayi2 +" (ID INT, NAME VARCHAR(50))", baglanti);
cmd.ExecuteNonQuery();
baglanti.Close();
}
答案 0 :(得分:0)
设置会话变量是一个简单的
Session["TableName"] = "gecici" + sayi2;
要检索,然后
string tablename = Session["TableName"].toString();
这是你在找什么,名称将是 gecici1234 ?