下面的数据只是样本数据
ID BatchName File
===========================
1 Batch1 null
2 Batch2 "C:\File2_1.pdf"
2 Batch2 "C:\File2_2.pdf"
3 Batch3 "C:\File3_1.pdf"
3 Batch3 "C:\File3_2.pdf"
Run Code Online (Sandbox Code Playgroud)
然后我有一个代表上述数据的类
public class SourceBatch
{
public int ID {get;set;}
public string BatchName {get;set;}
public string File {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
我把它通过想组ID和BatchName选择所有File该组中到列表中。为此,我有相应的课程
public class DestinationBatch
{
public int ID {get;set;}
public string BatchName {get;set;}
public IEnumerable<string> Files {get;set;} // this is list of string
}
Run Code Online (Sandbox Code Playgroud)
下面是执行此操作的代码
IList<SourceBatch> list = GetSourceList();
var result = list.GroupBy(x => new
{ …Run Code Online (Sandbox Code Playgroud) 我被困了 - 代码的第一部分" // OPEN PRELOADING PAGE "由于某种原因不会执行,将被跳过.如果我评论其余的代码,只保留这部分,它就可以了.怎么了?
protected void Create_Order_Click(object sender, EventArgs e)
{
// OPEN PRELOADING PAGE
Response.Write("<script>");
Response.Write("window.open('smth.aspx','_blank')");
Response.Write("</script>");
// DEFINE CONNECTION
SqlConnection conn = new SqlConnection(ConfigurationManager
.ConnectionStrings["SqlConnectionString"].ConnectionString);
// OPEN CONNECTION
conn.Open();
// DEFINE FIRST SQL QUERY
string insertOrder = "INSERT INTO Order_Connection (FK_User_ID) VALUES ('" + Session["User_ID"] + "')";
string str = FileUpload1.FileName;
FileUpload1.PostedFile.SaveAs(Server.MapPath(".") + "//upload//" + str);
string path = "//xxx.cz/intranet/pages/upload/" + str.ToString();
string insertOrder_Content = "INSERT INTO Order_Content (Uploaded_Photo, Issue_Description, Place_Of_Repair, Transfer_Method, Date_To_Bring, Date_To_Take) …Run Code Online (Sandbox Code Playgroud) 我不明白为什么我无法studentinformation从该功能访问getstudentinformation.这是代码:
static void Main(string[] args)
{
getstudentinformation();
string firstname = studentinformation[0];
}
static Array getstudentinformation()
{
Console.WriteLine("enter the student's first name: ");
string firstname = Console.ReadLine();
Console.WriteLine("enter the student's last name");
string lastname = Console.ReadLine();
Console.WriteLine("enter student's gender");
string gender = Console.ReadLine();
string[] studentinformation = { firstname, lastname, gender };
return studentinformation;
}
Run Code Online (Sandbox Code Playgroud)
Visual Studio无法识别数组,当我尝试构建代码时,存在无法识别学生信息的错误.
我有这个:
int minValue = int.Parse(min.Text);
int maxValue = int.Parse(max.Text);
Random rnd = new Random();
int final = rnd.Next(minValue, maxValue);
result.Text = final.ToString("");
Run Code Online (Sandbox Code Playgroud)
我将把两个值(较低的值和较高的值)放到两个文本框中.这些值由用户输入.当我生成随机数时,在任何情况下都不会出现更高的值.例如,用户输入1和5.我重复生成一个数字,在任何情况下都不会出现数字5.它只显示1,或2,或3,或4,而不是5.为什么?