Jump to content

Seuntjie

Member
  • Posts

    8
  • Joined

  • Last visited

Awards

This user doesn't have any awards

About Seuntjie

  • Birthday Jun 14, 1992

Contact Methods

Profile Information

  • Gender
    Male
  • Location
    South-Africa
  • Interests
    Programming, gaming, cryptocurrencies
  • Occupation
    Developer

Seuntjie's Achievements

  1. So the error you're getting is because you're trying to access a static properties from an instance of the object. Static properties are accessed using the class itself, where properties are accessed from the instance. For example: //Your class cass testclass { public static string StaticString="static string"; public string StringProperty {get;set;} public testclass() { StringProperty="string property"; } } //now somewhere else in your code: testclass tmpobject = new testclass(); //Now you can access StringProperty using: Console.WriteLine(tmpobject.StringProperty); //but you need to access StaticString using: Console.WriteLine(testclass.StaticString); //trying to use Console.WriteLine(tmpobject.StaticString); //will result in the same error you're getting now But to answer your question, you can't create an instance of a page in another page. You might be able to use the static property to reference the data, BUT it would not be unique to each user. Using static variables for this is a really bad idea. I would suggest you rather use session variables. To set a session variable, you simply use Session["variablename"]=object; and to read session variables you use yourclass object = (yourclass )Session["variablename"]; So in your case: ------------------------------Messages.aspx.cs-------------------------------------------------------------- public partial class Messages : System.Web.UI.Page { protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { Session["selectedvalue"] = GridView1.SelectedRow.Cells[1].Text; } } ----------------------------------------------------------------------------------------------------------------- ---------------------------Reply.aspx.cs--------------------------------------------------------------------- public partial class Reply : System.Web.UI.Page { string v = (string)Session["selectedvalue"]; }
  2. If this still isn't resolved, look at your datagridviews sorting properties. It might be that your grid is re-sorting the data after you bind the data to it.
  3. You can use clickonce (which is not a great platform) and it handles it automatically after you deploy the update to your fileserver. Clickonce is ported with visual studio or can be installed with the visual studio extentions, then you can enable it in the application properties. Alternatively you can use something like https://electron.atom.io/ and implement their updater. Electron is pretty popular and is used in a lot of microsofts products. It also allows you to deploy to a file server and let the user automatically download and install the updater.
  4. Basically: No table should have a column that is dependent on any column other than the primary key. Edit: That's probably not a great description if you're new to databases, sorry. But Organized link seems to explain it pretty well.
  5. There is no limit to the number of characters a label can show as far as I know. If you disable a labels auto-size property, you can resize it to a any size. As long as the label is larger than the space the text takes, it will display all of the text. But I also suggest using a multiline textbox or a richtextbox that is set to readonly. This has some perks over using a label, mainly that the textboxes will allow you to scroll if the text becomes larger than the space inside the text box, and you can select text (and thus copy) from inside of a textbox that is set to read-only but not from a label.
  6. I would suggest doing the search solely on DB and not in c#. It should be faster and likely easier. But for the case in hand: Instead of using enums (or dictionaries) create a risk class with the following properties: name:string, ibsRisk:bool, fodMapRis:bool, description:string. Then your ingredients would be: name:string, type:foodtype, calories:double, fiber:double, carb:double, fat:double, risks: risk[]. and meals: name:string, rating:double, instructions:string, timetocook:timespan, ingredients:ingredient[] You then have a foodtype class as well with whatever properties you need it to have. Now you can create a method in ingredients to check if the igredient contains a risk that will search through the risks array to find a match and return the applicable values. Then you can create a method in the meal class to check if the meal contains a risk that will step through the ingredients and check if the ingredients has that risk.
  7. Can you post the command you're using to compile?
  8. You're using the incorrect class to copy the data. You should be using SqlBulkCopy instead of OleDbTransaction. So replacing the line OleDbTransaction BKD = new OleDbTransaction(DestinationDB); //with SqlBulkCopy BKD = new SqlBulkCopy(DestinationDB); Should do the trick. Although I'm not sure how it's going to handle the oledb datareader with the sql connection. If you're using SQL Server, you should be using SqlConnection, SqlTransaction, SqlCommand etc instead of OleDbConnection etc. If you look at your errors, the first one in the screenshot shows that OleDbTransaction does not have a constructor with 1 parameter. This indicates that this statement is incorrect: new OleDbTransaction(DestinationDB); Namely, that the number of parameters between the brackets are incorrect. The other errors are saying that the type of object you're using doesn't have those properties or functions. This indicates one of two things: You're using the wrong property or method name (typo, completely wrong name etc) or the object type is incorrect.
×