The attached code works and displays a random number as long as I comment out the "int SearchInfo" line. How can I add a list I create to the code for it to search? I'm trying to insert the result of a Select statement Instead of using (1,2108). Obviously it's not working. My environment is Visual Studio, the language is C# and I'm attached to a SQL Server db.
I'm really new to C# so some working code would be greatly appreciated.
private void button1_Click(object sender, EventArgs e)
int SearchInfo = SELECT CompanyId FROM dbo.Company WHERE TimeZone = 6;
Random r = new Random();
int EmpNo = r.Next (1,2108);
txtEmpNo.Text = Convert.ToString(EmpNo);