I'm using visual studio 2012, c# and have created several windows form applications but whenever I try to run my program, there is an error with the "designer view":
this.employee_DatabaseDataSet = new Form1.Employee_DatabaseDataSet();
this.tblCustLoginBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tblCustLoginTableAdapter = new Form1.Employee_DatabaseDataSetTableAdapters.**tblCustLoginTableAdapter();
this.tableAdapterManager = new Form1.Employee_DatabaseDataSetTableAdapters**.TableAdapterManager();
It seems to me that there is a problem with my data source but I have started fresh so I don't see what the problem is.
This is the error that comes up:
"The type name Employee_DatabaseDataSet does not exist in the type form1.form1"
Can someone be so kind to help me please? Thanks for reading
you are missing the () parenthesis pair after Form1
Try this :
this.employee_DatabaseDataSet = new Form1().Employee_DatabaseDataSet();
this.tblCustLoginBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tblCustLoginTableAdapter = new Form1().Employee_DatabaseDataSetTableAdapters.tblCustLoginTableAdapter();
this.tableAdapterManager = new Form1().Employee_DatabaseDataSetTableAdapters.TableAdapterManager();
Related
I have a Visual Studio extension that we use internally for a project and one of the things it needs to be able to do is post tickets to VSTS. Previously we were using onsite TFS and making a connection to post tickets was as simple as:
var vssCreds = new VssCredentials(true);
projectCollection = new TfsTeamProjectCollection(url, vssCreds);
workItems = projectCollection.GetService<WorkItemStore>();
project = workItems.Projects["My Project"];
defaultType = project.WorkItemTypes["Bug"];
//...
var newItem = new WorkItem(defaultType)
{
Title = title
};
newItem.Fields["Assigned To"].Value = assignTo;
newItem.Fields["Repro Steps"].Value = repoSteps;
var validationResult = newItem.Validate();
newItem.Save();
And this worked fine. But after upgrading to VSTS I'm having a hard time getting the credentials part to work. I changed this line:
projectCollection = new TfsTeamProjectCollection(url, vssCreds);
To this:
projectCollection = new TfsTeamProjectCollection(url, new VssClientCredentials());
And this worked fine for me. But when I share it with other people on my team it didn't work at first and then started working a little later. I am guessing that interacting with VSTS caused their credentials to be loaded so that it then worked. But I have at least one person who just seems to be completely unable to make it work.
So what's the correct way to get it to use the VSTS credentials (that should already exist in VS)?
I see this overload for VssClientCredentials (https://msdn.microsoft.com/en-us/library/dn228355(v=vs.120).aspx):
public VssClientCredentials(
IVssCredentialPrompt credentialPrompt
)
Which I suspect might be useful, but I can't seem to find out if there's a built in implementation of IVssCredentialPrompt somewhere or, if not, how to implement it.
Remove the related key from
Computer\HKEY_CURRENT_USER\Software\Microsoft\VSCommon\14.0\ClientServices\TokenStorage\VisualStudio\VssApp, then authentication again.
You also can specify other Kind (vssApp by default) and Namespace (VisualStudio by default) by using this code:
var c = new VssClientCredentials();
c.Storage = new VssClientCredentialStorage(storageKind: "VssApp2", storageNamespace: "VisualStudio");
projectCollection = new TfsTeamProjectCollection(url, c);
For reasons that are entirely unclear and from this answer to an entirely different question: https://stackoverflow.com/a/40256731/1250301
It seems that spawning a new thread causes a login prompt to appear if needed and fix all the problems. So if I do this:
Task.Run(() =>
{
var url = new Uri(_tfsUrl);
var cred = new VssClientCredentials();
projectCollection = new TfsTeamProjectCollection(url, cred);
workItems = projectCollection.GetService<WorkItemStore>();
}).Wait();
project = workItems.Projects["Job Posting Data"];
defaultType = project.WorkItemTypes["Bug"];
taskType = project.WorkItemTypes["Task"];
Then it works. I have no idea why it works, or why this is necessary (at first I thought maybe it was a problem with not being in the UI thread so I'd tried Application.Current.Dispatcher.Invoke which did not work) but it seems to have fixed the problem.
I want to create issue. Wsdl can be found here. I have created client using Visual Studio and c#.
I can login
JiraSoapServiceService jiraSoapService = new JiraSoapServiceService();
jiraSoapService.login(jiraLogin, jiraPassword);
I can get information
jiraSoapService.getIssue(auth, key);
but I can not create an issue
RemoteIssue issue = new RemoteIssue();
issue.setSummary(SUMMARY_NAME);
as it gives me JIRA_API.box.RemoteIssue does not contain a definition for setSummary. Whats is wrong?
RemoteIssue issue = new RemoteIssue();
issue.project = "[NAME]";
issue.key="[KEY]";
issue.type = "3";
RemoteComponent component = new RemoteComponent();
component.name = "[COMPONENT_NAME]";
issue.components = (new RemoteComponent[] { component });
issue.summary = "[SUMMARY]";
issue.assignee = "[ASSIGNEE]";
RemoteIssue returnedIssue = jiraSoapService.createIssue(token, issue);
I'm trying to use the InitiateFileTransferToGuest method to send a file to a VM. Unfortunately, I'm getting stuck. Here's the related code where VClient is the VimClient with an already successfull connection:
GuestOperationsManager VMOpsManager = new GuestOperationsManager(VClient, VClient.ServiceContent.GuestOperationsManager);
GuestFileManager VMFileManager = new GuestFileManager(VClient, VClient.ServiceContent.FileManager);
GuestAuthManager VMAuthManager = new GuestAuthManager(VClient, VClient.ServiceContent.AuthorizationManager);
NamePasswordAuthentication Auth = new NamePasswordAuthentication()
{
Username = "username",
Password = "password",
InteractiveSession = false
};
VMAuthManager.ValidateCredentialsInGuest(CurrentVM.MoRef, Auth);
System.IO.FileInfo FileToTransfer = new System.IO.FileInfo("C:\\userlist.txt");
GuestFileAttributes GFA = new GuestFileAttributes()
{
AccessTime = FileToTransfer.LastAccessTimeUtc,
ModificationTime = FileToTransfer.LastWriteTimeUtc
};
string TransferOutput = VMFileManager.InitiateFileTransferToGuest(CurrentVM.MoRef, Auth, "C:\\userlist.txt", GFA, FileToTransfer.Length, false);
First error shows up when getting to the ValidateCredentialsInGuest method. I get this message:
An unhandled exception of type 'VMware.Vim.VimException' occurred in VMware.Vim.dll Additional information: The request refers to an unexpected or unknown type.
If I remove that validation, I get the same error when trying to run InitiateFileTransferToGuest. I've been browsing the API documentation, and threads in VMware forums and a lot of places to be honest. The only pieces of code I've seen posted where it works were in Java and Perl, but the API implementation is a little different than C#. Any idea where to look?
Thank you!
I made it work after testing and making up stuff. I guessed the MoRef for both AuthManager and FileManager doing the following:
ManagedObjectReference MoRefFileManager = new ManagedObjectReference("guestOperationsFileManager");
GuestFileManager VMFileManager = new GuestFileManager(VClient, MoRefFileManager);
ManagedObjectReference MoRefAuthManager = new ManagedObjectReference("guestOperationsAuthManager");
GuestAuthManager VMAuthManager = new GuestAuthManager(VClient, MoRefAuthManager);
Now it's working, and I have no idea how.
I have a C# windows application in which there are many crystal reports.I call and show them using the following piece of code :
rptDDCollection rpt = new rptDDCollection();
rpt.SetDatabaseLogon(Connect.sDatabaseUserName, DLL.Connect.sDatabasePassword, "", Connect.sCurrentDatabase);
rpt.RecordSelectionFormula = "";
frmReports frm = new frmReports();
frm.crViewer1.DisplayGroupTree = false;
frm.crViewer1.ReportSource = rpt;
frm.crViewer1.SelectionFormula = rpt.RecordSelectionFormula;
frm.crViewer1.Show();
frm.Show();
Now, the issue is that I have 2 databases to work on.Things work fine with one database.I have to use the same report but very often I need to view data from the other database.The database engine is SQL server.While searching on the net and on stack overflow, I found suggestions to set the database name dynamically through code.What should be done to achieve what I want in this case?
I worked this around by setting database name for the tables in the report.I made one change in the actual code above.I created a method called ApplyLogonInfo and passed the report object to it.Inside the method I wrote the code for setting database name for the report tables dynamically.This is the modified code:
rptDDCollection rpt = new rptDDCollection();
rpt.SetDatabaseLogon(Connect.sDatabaseUserName, DLL.Connect.sDatabasePassword, "", Connect.sCurrentDatabase);
ApplyLogOnInfo(rpt);
rpt.RecordSelectionFormula = "";
frmReports frm = new frmReports();
frm.crViewer1.DisplayGroupTree = false;
frm.crViewer1.ReportSource = rpt;
frm.crViewer1.SelectionFormula = rpt.RecordSelectionFormula;
frm.crViewer1.Show();
frm.Show();
Below is the newly created method:
public static void ApplyLogOnInfo(ReportClass rpt)
{
TableLogOnInfo info = new TableLogOnInfo();
info.ConnectionInfo.DatabaseName = Connect.sCurrentDatabase;
for (int i = 0; i < rpt.Database.Tables.Count; i++)
{
rpt.Database.Tables[i].ApplyLogOnInfo(info);
}
}
sCurrentDatabase is the name of the database that has been currently selected for viewing.
This enabled me to set the database name dynamically, and now I can work with 2 (or in general multiple) databases and view the data from whichever database I wish to see.
I have implemented quickfix engine using asp.net and C#.
and i am calling quickfix_net.dll which is written in unmanaged C++.
but i am getting error like "Cannot pass a GCHandle across AppDomains" when calling quickfix_net.dll.
but the same thing is running in console application but not under IIS i.e asp.net
please anybody look into matter.
thanks in advance
Following are my code:
SessionSettings settings = new SessionSettings(tradeClientPath);
ApplicationMessage application = new ApplicationMessage();
FileStoreFactory storeFactory = new FileStoreFactory(settings);
FileLogFactory logFactory = new FileLogFactory(settings);
MessageFactory messageFactory = new DefaultMessageFactory();
SocketInitiator initiator = new SocketInitiator
(application, storeFactory, settings, logFactory, messageFactory);
initiator.start();
Message message = new Message();
OrdType ordType = new OrdType(OrdType.MARKET);
QuickFix42.NewOrderSingle newOrderSingle = new QuickFix42.NewOrderSingle(new ClOrdID("1"), new HandlInst('1'), new Symbol("WAKEN\00110048=2")
, new Side(Side.BUY), new TransactTime(), new OrdType(OrdType.MARKET));
newOrderSingle.set(new OrderQty(10));
newOrderSingle.set(new TimeInForce(TimeInForce.DAY));
Message.Header header = newOrderSingle.getHeader();
header.setField(new SenderCompID("CLIENT1"));
header.setField(new TargetCompID("EXECUTOR"));
message = newOrderSingle;
**QuickFix.Session.sendToTarget(message);** // here i am getting exception
initiator.stop();
Web site reference is : http://www.quickfixengine.org/quickfix/doc/html/index.html
It's a known issue with QuickFix.Net, it only works in-proc. So basically there are not many options, short of changing FIX plugin.