|
kubiiik wrote: So I thought that there is something else I should set.. You should be able to sign in on your own website without modifications. The WebBrowser-control is "just" an instance of IE, nothing special.
The thing that threw me off was the reference to "other domains". You wouldn't be able to authenticate people from the domain our company uses, simply because it is outside the network.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: You should be able to sign in on your own website without modifications. The WebBrowser-control is "just" an instance of IE, nothing special.
Just to clarify, we do not display any login page in the webBrowser. If the user log in using regular browser, the log in page is displayed. But when using the C# winforms app, the log in is set in the app and used as string in the Authenticate method.
Eddy Vluggen wrote: The thing that threw me off was the reference to "other domains". You wouldn't be able to authenticate people from the domain our company uses, simply because it is outside the network.
I don't understand the domain users much (I had to google more info about it), but I think that the domain controller should handle the users (according to http://www.howtogeek.com/194069/what-is-a-windows-domain-and-how-does-it-affect-my-pc/[^]).
|
|
|
|
|
kubiiik wrote: Just to clarify, we do not display any login page in the webBrowser. If the user log in using regular browser, the log in page is displayed. But when using the C# winforms app, the log in is set in the app and used as string in the Authenticate method. Thanks for that clarification
I was expecting windows-authentication, which would not require a special login.
kubiiik wrote: I don't understand the domain users much (I had to google more info about it), but I think that the domain controller should handle the users Yes, but you won't be able to verify anyone outside your own domain.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
According to the new information I got, the server end has only implemented WindowsBasicAuthenticator, which ignores these domains.
But unless the server end implementation is updated, I will not know that for sure.
Anyway, thank you for your time 
|
|
|
|
|
I recently installed Microsoft Visual Studio Community 2015.
When running my app in Visual Studio (developed with previous version of Visual c# as express edition 2005, 2008, 2010) , it's ending on unhandled exceptions rather than showing a message box with the exception info and continuing on as I was used to.
What options do I need to change to get it back to the behavior I'm used to (with Visual c# express edition 2005, 2008, 2010)?
Regards
Roberto
|
|
|
|
|
Since we have no idea what your code is doing, it is impossible to answer. You need to collect more information about where the exception occurs, and why.
|
|
|
|
|
Ok I think that what is doing the sw now is not important. Before (years ago), when I was creating the app and testing it (but this was common to any app created in the past), the environment Visualc# express edition 2010 was configured in a way that, in case of error, a popupwindow was showed besides the line where the code was halted because of a Runtime error. Popup Windows was giving some information, in some cases very exhaustive in some other less but useful anyway about the reason of the fault.The line of code itself was highlighted green (or some other color i can't remember). So I knew where the code had a problem (Runtime). Now the point of your question is exactly this. In the new environment I cannot identify neither the point nor the reason for the fault. The app exits and simply return an error code not so useful in my opinion.
Regards
Roberto
|
|
|
|
|
The information should all be provided by the debugger.
|
|
|
|
|
Check out the options under Tools -> Options -> Debugging -> General
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
|
|
|
|
|
Ok I did this trying to follow suggestions found around on the net. None was working. So what should I check or uncheck in your opinion?
Regards
Roberto
|
|
|
|
|
Break all processes
Break when exceptions cross AppDomains
Enable the Exception Assistant
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
|
|
|
|
|
And if nothing there helps, put an unhandled exception handler in your code and find out what is going on.
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
|
|
|
|
|
Ok I set all exceptions around to break the app. It doesn't seem to work. But then I added this :
int j = 0;
int i = 3 / j;
and I had the usual behaviour with line "int i = 3 / j;" highlighted and the relevant exception display.
code is something like :
[DllImport("AVICAP32.dll")]
public static extern bool capGetDriverDescriptionA(
short wDriver,
string lpszName,
int cbName,
string lpszVer,
int cbVer
);
bool bReturn;
bReturn = MyAppCam.Capture.capGetDriverDescriptionA(x,strName,100,strVer,100);
I know that code is stopping on "bReturn = MyAppCam.Capture.capGetDriverDescriptionA ... "
Regards
Roberto
|
|
|
|
|
private void fnLoadSignature()
{
try
{
SqlConnection con = new SqlConnection(conString);
con.Open();
string sql = "SELECT SignatureOfMember FROM CIF WHERE CIFKey = '" + txtcifkey.Text + "'";
cmd = new SqlCommand(sql, con);
object value = cmd.ExecuteScalar();
byte[] data = (byte[])cmd.ExecuteScalar();
MemoryStream strm = new MemoryStream();
strm.Write(data, 0, data.Length);
strm.Position = 0;
System.Drawing.Image img = System.Drawing.Image.FromStream(strm);
BitmapImage bi = new BitmapImage();
bi.BeginInit();
MemoryStream ms = new MemoryStream();
img.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
ms.Seek(0, SeekOrigin.Begin);
bi.StreamSource = ms;
error is her------ bi = SigPics.Cursor;
bi.EndInit();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
|
|
|
|
|
You never described what you mean by "load signature pad" and your code says there's an exception being thrown but you never say what that exception is.
With the complete lack of information you provided, the only thing anyone can tell you is to cal the support line of the manufacturer of the pad you're using.
|
|
|
|
|
And to add to what Dave said: Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Relevant xkcd: Exploits of a Mom
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
|
You're creating an empty stream, loading an image from that. Then you create a new stream, and save the image there that was created from the empty stream.
Google for "load image from database WPF"
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
i have data and chart in excel work sheet which i need to copy at run time from excel to power point slides.
i have a code which is working fine but the code only can copy chart data to excel sheet not range data.
please see the scree shot of my excel. so anyone can get idea how data is there in my work sheet which i need to copy to power point slide programmatically. enter image description here
screen shot url....please see it. [screen shot url]
here is code which i am using to copy range data and chart data to power point dynamically.
private void Form1_Load(object sender, EventArgs e)
{
pptNS.ApplicationClass powerpointApplication = null;
pptNS.Presentation pptPresentation = null;
pptNS.Slide pptSlide = null;
pptNS.ShapeRange shapeRange = null;
xlNS.ApplicationClass excelApplication = null;
xlNS.Workbook excelWorkBook = null;
xlNS.Worksheet targetSheet = null;
xlNS.ChartObjects chartObjects = null;
xlNS.ChartObject existingChartObject = null;
xlNS.Range destRange = null;
string paramPresentationPath = @"D:\test\Chart Slide.pptx";
string paramWorkbookPath = @"D:\test\MyExcelData.xlsx";
object paramMissing = Type.Missing;
try
{
powerpointApplication = new pptNS.ApplicationClass();
excelApplication = new xlNS.ApplicationClass();
excelWorkBook = excelApplication.Workbooks.Open(paramWorkbookPath,
paramMissing, paramMissing, paramMissing,
paramMissing, paramMissing, paramMissing,
paramMissing, paramMissing, paramMissing,
paramMissing, paramMissing, paramMissing,
paramMissing, paramMissing);
targetSheet =
(xlNS.Worksheet)(excelWorkBook.Worksheets["Spain"]);
chartObjects =
(xlNS.ChartObjects)(targetSheet.ChartObjects(paramMissing));
pptPresentation = powerpointApplication.Presentations.Add(
Microsoft.Office.Core.MsoTriState.msoTrue);
pptSlide =
pptPresentation.Slides.Add(1, pptNS.PpSlideLayout.ppLayoutBlank);
destRange = targetSheet.get_Range("A1:B15");
destRange.Copy();
shapeRange = pptSlide.Shapes.Paste();
shapeRange.Left = 60;
shapeRange.Top = 100;
existingChartObject =(xlNS.ChartObject)(chartObjects.Item(1));
existingChartObject.Copy();
shapeRange = pptSlide.Shapes.Paste();
shapeRange.Left = 90;
@shapeRange.Top = 100;
pptPresentation.SaveAs(paramPresentationPath,
pptNS.PpSaveAsFileType.ppSaveAsOpenXMLPresentation,
Microsoft.Office.Core.MsoTriState.msoTrue);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
shapeRange = null;
pptSlide = null;
if (pptPresentation != null)
{
pptPresentation.Close();
pptPresentation = null;
}
if (powerpointApplication != null)
{
powerpointApplication.Quit();
powerpointApplication = null;
}
targetSheet = null;
chartObjects = null;
existingChartObject = null;
if (excelWorkBook != null)
{
excelWorkBook.Close(false, paramMissing, paramMissing);
excelWorkBook = null;
}
if (excelApplication != null)
{
excelApplication.Quit();
excelApplication = null;
}
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
please see my code and tell me what to rectify in my code as a result cell range and chart both i can copy to power point slides.
thanks
tbhattacharjee
|
|
|
|
|
What you should do is find out how to do it manually, and once you know nomenclature, you'll know how to google how to do it in code.
Here's a place to start:
Import data from Excel into PowerPoint - PowerPoint
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I tried this query in sql.But getting errors like
'The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.'
<pre lang="SQL"> declare cur cursor for Select Table_Name From INFORMATION_SCHEMA.COLUMNS Where column_name = 'INV_DATE'
declare @tablename nvarchar(max)
declare @sqlstring nvarchar(max)
open cur
fetch next from cur into @tablename
while @@fetch_status=0
begin
--print @tablename
set @sqlstring = 'update '+@tablename+' SET INV_DATE = CONVERT(varchar(10),INV_DATE,105)'
exec sp_executesql @sqlstring
fetch next from cur into @tablename
end
close cur
deallocate cur
Please suggest me a solution
current format:2016-03-31 00:00:00.000
Required Format:31-03-2016
DataType:DateTime
|
|
|
|
|
This isn't related to C#, so it's in the wrong place.
But it's a rookie mistake, and I'll answer it as a result.
There is but one solution: change your database.
Never store dates in NVARCHAR columns - always use DATETIME or DATE instead.
If you use the wrong column datatype it's easy to set up, and lazy to get the user data into - but it always gives total nightmares after that - because the data in your DB is not valid, or is not in a consistent format, or is in a different format from that which SQL expects.
Think about it: 10/11/12 is a valid date. But is it 10th Nov 2012, 11th Oct 2012, 12th Nov 2010, or some other value entirely? The only time you can tell is when the user inputs the value, and you use his culture to convert it to a DateTime value - as soon as it arrives in the DB it's too late because you no longer have any idea what date format he used: it could be US: MM/DD/YY, European: DD/MM/YY, or ISO / Japanese YY/MM/DD - and you don't even know that the user is using the same calendar as you so the year could be well different (the Hijri date today is Jumada Al-Awwal 3, 1438)! Or even that he didn't enter "hello, my name is Jackie" which isn't even close to a date.
So when you try to convert it to a date at a later time you are almost guaranteed to get errors because the SQL server will try to convert it using it's culture - and generally you don't even know what culture the server is set to!
Always use appropriate data types - it may be easier for your code to slam in NVARCHAR all the time, but it wastes huge amounts of effort later fixing up the holes it leaves.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I tried to convert in single table also containing date format in datetime as 2016-03-31 00:00:00.000.
update invINVOICE set INV_DATE =convert(datetime,convert(datetime,INV_DATE ,(105)))
But still got the same error while running the query.
I already written script for database to convert all the columns to datetime with a format '2016-03-31 00:00:00.000'
Now they want only date format containing dd-mm-yyyy.
Please suggest me solution this time.
|
|
|
|
|
You can't. DATETIME fields don't have a format - they are stored as a number of tick since a preset point in time (for SQL Server, that's "ticks since Jan 1st 1753") so quite what you expect two datetime conversions to do I'm not quite sure.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|