|
I'm sorry this doesn't help me.
The resolve event should be triggered automatically when a dll is missing.
It doesn't trigger at all.
|
|
|
|
|
It is triggered automatically, on every assembly load.
The question is did you wire up the event correctly in your code?
|
|
|
|
|
I can't find any true answer to that only answers that have worked for other people with other setups different from mine.
So I have tried various solutions that have worked for others but it doesn't work for me.
Question is it possible that it is not triggered by recursive loads?
I mean if one dll that I see in the project needs another dll that is missing maybe then the resolve function is not triggered?
I mean in my cefsharp project (embedded chrome for c#) I have one dll named:
libcef.dll
This dll is not visible in the reference section but the application needs it anyway.
Costura.Fody doesn't embed this dll.
|
|
|
|
|
I did another test:
I renamed
CefSharp.Core.dll to something else.
This dll is listed in the references.
The resolve function was successfully triggered.
Okay, so the question is, how do I embed everything and create one stand-alone exe?
How can I embed all resources not only the dll's but everything needed in the exe?
This is what I originally wanted.
|
|
|
|
|
You can only embed .NET .DLL's. If it's a C/C++ library .DLL, it cannot be embedded into the executable.
The library .DLL's are not loaded through the .NET CLR binding mechanism, so they will not have a binding event triggered for them.
modified 21-Apr-20 10:21am.
|
|
|
|
|
I now have a net core api service up and running on a Linux box using Nginx as a reverse proxy server, I can call all of the controller methods that don't have parameters and they return collections of my custom classes. But I'm stuck on one get method that requires a custom class as an input parameter, the controller method code is below
[HttpGet]
[ActionName("GetBOM")]
public ActionResult<bomparam> GetBOM([FromBody] BOMParam bp)
{
// This calls my DAL which queries a database and returns the bp populated with various values
return businessLayer.APIGetBOM(bp);
}
What I can't figure out is how to pass a class instance as a parameter to the method using RestSharp
This is what I've tried
Hide Copy Code
RestClient client = new RestClient("http://IPOfRestService:Port/GetBOM");
RestRequest request = new RestRequest(Method.GET);
BOMParam bp = new BOMParam();
bp.ValveCode = "80044-08";
bp.Torque = 20;
bp.DirectFit = false;
bp.BarPressure = 6;
request.AddJsonBody(bp);
IRestResponse response = client.Execute(request);
I get a not found back in the response object.
Can't find anything googling so thought I'd try here
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
|
|
|
|
|
|
Hi Gerry, I followed that link and the only thing the guy was doing differently to me was issuing a Post whereas mine is a Get - apparently it's frowned upon to add a body to a Get request , so I modified my Controller and it worked - it's not returning what I expect but that's probably anther story - thanks for the heads up
Edit
Using the RestSharp deserializer doesn't map the property names that are in different case though , JsonSoft does
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
modified 19-Apr-20 7:30am.
|
|
|
|
|
How to get the status of files that are sent for Printing through VS 2015?
|
|
|
|
|
To monitor the status of a printer from an interactive application, add a reference to the System.Printing assembly, use the PrintServer class[^] to enumerate the print queues, and use the returned PrintQueue[^] instance to monitor the queue.
NB: This is not supported within a Windows Service or ASP.NET project.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
SELECT p.pcode, p.pdesc, b.brand, c.category, p.price p.qty
FROM tblProduct
as p inner join tblBrand
as b on b.id = p.bid inner join tblCategory
as c on c.id = p.cid
where p.pdesc like '%'
--------------------------------------
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '.'.
|
|
|
|
|
You're missing a comma between the last two columns:
SELECT p.pcode, p.pdesc, b.brand, c.category, p.price p.qty should be:
SELECT p.pcode, p.pdesc, b.brand, c.category, p.price, p.qty
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Im trying to make loadData to datagridview in c#. Is there something wrong on my code?
public void LoadRec()
{
try
{
int i = 0;
dgvProduct.Rows.Clear();
_sqlConn.Open();
_sqlCmd = new SqlCommand("SELECT p.pcode, p.pdesc, b.brand, c.category, p.price, p.qty FROM tblProduct as p inner join tblBrand as b on b.id = p.bid inner join tblCategory as c on c.id = p.cid where p.pdesc like '" + txtSearchProd.Text + "%'", _sqlConn);
_sqlDR = _sqlCmd.ExecuteReader();
while (_sqlDR.Read())
{
i++;
dgvProduct.Rows.Add(i, _sqlDR[0].ToString(), _sqlDR[1].ToString(), _sqlDR[2].ToString(), _sqlDR[3].ToString(), _sqlDR[4].ToString(), _sqlDR[5].ToString());
}
_sqlDR.Close();
_sqlConn.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
_sqlConn.Close();
}
|
|
|
|
|
Yes. Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
Also, don't store connection, command, or data reader objects in class-level fields. Create them as local variables when they're required, and wrap them in using blocks.
using (var sqlConn = new SqlConnection("..."))
using (var sqlCmd = new SqlCommand("SELECT p.pcode, p.pdesc, b.brand, c.category, p.price, p.qty FROM tblProduct as p inner join tblBrand as b on b.id = p.bid inner join tblCategory as c on c.id = p.cid where p.pdesc like @SearchProd + '%'", sqlConn))
{
sqlCmd.Parameters.AddWithValue("@SearchProd", txtSearchProd.Text);
sqlConn.Open();
using (var sqlDR = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection))
{
while (sqlDR.Read())
{
i++;
dgvProduct.Rows.Add(i, sqlDR[0].ToString(), sqlDR[1].ToString(), sqlDR[2].ToString(), sqlDR[3].ToString(), sqlDR[4].ToString(), sqlDR[5].ToString());
}
}
}
Everything you wanted to know about SQL injection (but were afraid to ask) | Troy Hunt[^]
How can I explain SQL injection without technical jargon? | Information Security Stack Exchange[^]
Query Parameterization Cheat Sheet | OWASP[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
When I try to execute the code Sir, there is no data displayed on my datagrid.
I also try the to run these query on my sqlserver.
SELECT p.pcode, p.pdesc, b.brand, c.category, p.price, p.qty
FROM tblProduct
as p inner join tblBrand
as b on b.id = p.bid inner join tblCategory
as c on c.id = p.cid
where p.pdesc like '%'
but theres no data showed.
|
|
|
|
|
Then there is no matching data in your database.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Start by cutting it down and trying it in SSMS:
SELECT p.pcode, p.pdesc, b.brand, c.category, p.price, p.qty
FROM tblProduct p
INNER JOIN tblBrand b
ON b.id = p.bid
WHERE p.pdesc LIKE '%'
And see if you get any rows.
If you don't, remove the JOIN and see what p.pid values you do get, then look at tblBrand to see if they exist. Remember that an INNER JOIN requires a matching entry in BOTH tables to return ANY rows.
If you do, add the second JOIN and see what you get.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have two classes like this
public myclass1
{
public int Id {set;get;)
public myclass2 MyClass2{set;get;)
}
public myclass2
{
public int Id {set;get;}
public string Name {set;get;}
}
public list<myclass1> mylist = new List<myclass1>() ;
my list has been bonded to datagridview .
when displying the collection in the grid , the myclass1 is displaying the object name "DomaninName.myclass2"
how to display the propery "Name" of myclass2
|
|
|
|
|
you can overwrite the ToString function
|
|
|
|
|
thank you it works fine for me .
|
|
|
|
|
First, fix the compilation errors in your code: use of ')" where it should be '}', missing class keyword on class definitions, missing uppercase on List , that sort of thing.
So us code that works to demonstrate your problem - not a lump of crap your threw together and didn't check at all ...
You can display what you want as the cell content, just override ToStrign in your class:
public class myclass2
{
public int Id { set; get; }
public string Name { set; get; }
public override string ToString()
{
return $"{Id}:{Name}";
}
}
You can also set the column header text to something more human readable than the property name - just set the HeaderText property of the column:
myDataGridView.DataSource = mylist;
myDataGridView.Columns[1].HeaderText = "My other class";
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have two c# form apps which use openFileDialog. One displays the targa bitmap with the system thumbnail in the corner (app1) and the other displays the system thumbnail(app2). The one which fails to display the targa bitmap shows the option to create a new folder while the other does not offer that option.
App1 I created using Microsoft tutorial1 Create a picture Viewer
App2 is called TargaImage_demo downloaded from this site.
I have compared the two projects making sure they use the same .Net framework but I cannot see why one works as I want it to do while the other fails to display the bitmaps.
Does anyone know why there is a difference between the two openFileDialogs?
|
|
|
|
|
Don't post this here - if you got the code from an article, then there is a "Add a Comment or Question" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
At a guess, have you called EnableVisualStyles[^] in one application but not the other?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
OpenFileDialog has nothing to do with displaying the image at all.
An OFD is only concerned with one thing, returning a string containing the path to a file. That's it. Nothing else.
The code to display the image is somewhere else and is where the problem appears to be.
|
|
|
|