這是我的控制器,我創建了一個DataTable。使用sql數據庫表屬性作爲日誌用於Web應用程序中的用戶憑據
public class HomeController : Controller
{
string connString = "Data source=DEVELOPER1; Initial catalog=Temp;Integrated security=True";
string commString = "";
public ActionResult Index()
{
List<string> list = new List<string>();
commString = "select * from usermaster";
DataTable datatable = GetDataTable(commString);
return View(datatable);
}
public DataTable GetDataTable(string strQuery)
{
DataTable datatable = new DataTable();
using (SqlConnection conn = new SqlConnection(connString))
{
conn.Open();
using (SqlCommand comm = new SqlCommand(commString, conn))
{
SqlDataReader sqlDataReader = comm.ExecuteReader();
datatable.Load(sqlDataReader);
}
}
return datatable;
}
這是我的看法。
<input type="text" id="text1" value="" />
<br />
<br />
<input type="text" id="text2" value="" />
<br />
<br />
<input type="button" id="button1" value="Button" onclick="button1_click()" />
下面是我在commString已經使用了查詢的截圖。
這是我當前項目位置輸出的圖像。
現在,我的要求是,如果在這兩個文本字段中把「ADM」的用戶,然後它會顯示警告框「真」,否則將顯示「假」。 即使用戶留下任何一個空白,也會顯示「false」。 請幫忙。
讓我們看看'Download' [發佈]行動 –
你傳遞整個用戶名+密碼列表中視圖(即使只有一個值),並且你已經標記了這個jQuery(儘管除了ajax帖子之外沒有javascript)。您是否在尋找一些javascript來檢查用戶名和密碼並顯示警告/消息框?不要 - 這將會是一個巨大的安全風險,並且無法登錄。 –
這只是一個原型,我在學術水平。我只需要向我的教員展示完成的任務。 – Amit