James Alexander's Q&A profile
Visual Studio 2008 (Pre-release) DataContext
What is the difference between DataContext="{Binding Source={StaticResource myDataSource}}" and DataContext="{StaticResource myDataSource}" where myDataSource is a DataProvider. This isn't a definitive answer, since I might be missing something, but I think the second example is the "right" way to do it. In the first example you're actually databinding the DataContext itself. Since the instance of the datasource isn't going to change (it's data will), this is an unecessary step that has the overhead of being done through a binding as opposed to a simple property set. Consequently I never use the first and always use the second. HTH, Drew ...Show All
SQL Server I use the newest version JDBC, but still return no suitable driver error
Hi. I am using the following statements to connect my SQL Server 2005 database: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance(); con = DriverManager.getConnection("jdbc:sqlserver:172.16.0.5//:1433; DatabaseName=Security", "pasw", "pasw"); These code works for couple months, and later on, it returns "java.sql.SQLException: No suitable driver" Error. Then I download the jdbc driver from MS for SQL Server 2005, but it still return such errors. Also, here is one sample way to connect using SQL 2005 driver: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection conn = DriverManager. ...Show All
.NET Development Regarding Debug.writeline()
hi im using Debug.writline() method in my class.I don know where the writeline() method will write to..Can anyone help me in this issue WriteLine will write to the trace listeners in the Listeners collection. The default for this collection is to contain a DefaultTraceListener that will emit the information using OutputDebugString. If you are running your debugger this will appear in the output window. ...Show All
SQL Server Error loading Query Execution Plan
I am trying to tune a very long running query (18 minutes on an Axim X51, 8secs on my laptop), but I can't get the query plan file that is generated on the device to load in the Sql Server Management Studio. I am using the Sql Everywhere CTP on the device, and version 9.00.2047 of the management studio shell. FWIW, when I try to create the execution plan by running the same query on a .sdf file local on my laptop, I get a similar error trying to view the query plan. Apart from the query plan issues, it would appear (just from the query execution time) that the indexes defined on the sdf file are not being used when executing the query on the device, but are being used when executing the query on the laptop. This is pure S ...Show All
Microsoft ISV Community Center Forums Some EXCEL VBA tips
Does anyone know where I can find a guide to retrieving and updating data from a database into my Excel workbook. I would like the user to enter a date, and excel then connects to the database to get the information and populate a template I've created. Any pointers Ta I haven't a guide but there is a wizard built into Excel to do what your looking for. If you go Data->Import External Data->New Database Query there is a way there. If you looking for information on how to use this try the help, for example the help points you to two online training pages on how use the wizards involved. http://office.microsoft.com/training/training.aspx AssetID=RC011831161033 http://office.microsoft.com/trainin ...Show All
Visual C# SecurityException
Hi, I got the security exception in underlined code: string sAppProgID = "Excel.Application"; object oExcel = null ; try { oExcel = Marshal.GetActiveObject(sAppProgID); } catch (Exception ex) { MessageBox.Show(ex.StackTrace); try { Type tExcelObj = Type.GetTypeFromProgID(sAppProgID); oExcel = Activator.CreateInstance(tExcelObj); } catch (Exception ex2) { MessageBox.Show(ex2.StackTrace); return ; } } Why is it happened and how can I solve it Thank's Alexei Hi, The type of oExcel object is Object and I can't take the exist object of Excel or create new object of Excel. It tells me security exception. If I add it to security permissions I get error with n ...Show All
Visual Studio Express Editions How can I send to Private Sub Label26_Click a MSComm1 object
Hi, I defined MScomm1 in form1_load and I want to use him or to close him when the user click on the label26, how can I do it here is how I defined MSComm1: Private Sub Form1_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase .Load Dim MSComm1 As System.IO.Ports.SerialPort = My .Computer.Ports.OpenSerialPort(1, 19200, 0, 8, 1) End Sub Private Sub Label26_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label26.Click ' here I want to close Mscomm1 or to change him 'Or to change the port number and this change will take effect on the all program ' End Sub Regards, Yaniv &nbs ...Show All
Visual Studio Team System Completely Removing Team Builds from Process Template
I am creating a new Process Template for our Software Support Team. They have no need at all for Team Builds or Source Control. They don't touch the code or build it. I removed the Plugin, group and tasks from the ProcessTemplate.xml but the Team Builds folder still shows up in the Team explorer when I create a new project based on this template. Is there anyway of getting rid of it completely I have the same question with the Version Control node. But at least when you right click on the Version Control node nothing shows up. I already fixed up the ProcessGuidance.xml so I dont create the Source Control branch. But I really can't disable a Plugin for all projects. I need Build and source Control for all my other projects ...Show All
.NET Development how to download a file ?
Sir, I want to know that how to download a file from URL using C#.NET. I do a coding for the application about Download Manager,but at the time of downloading a file ie to save the file, the file is saved at its specified location ,but all files are corrupted. So tell me that what type of coding i can do in C#.NET. I think you are opening file before it completely gets downloaded from the server, You are using asyncrhnous way to download file and you have to make sure that file has been totally been grabbed from the server before you open that. Try to add an event handler for DownloadFileCompleted event of WebClient and open that file only after that event is raised.... I hope this will help. Also try DownloadFile() instead of Dow ...Show All
Visual Basic Optimizing Search
I am using VB.NET 2003 and MS Access. I have a TextBox and below it is a ListView control. As the user types a character in the TextBox, the records starting with that character get filled in the ListView control. The records are fetched from either Oracle or Access database. Previously, I used to execute a SQL query, which looked something like this: "Select FirstName from TableName where FirstName like '" & TextBox.Text & "'%" This query was set to execute as the text in the TextBox changed. If the TextBox is blank, then all the records get displayed on the ListView alphabetically. Now I have decided to use a different approach so as not to query the database again and again. Now what we are doing is that ...Show All
Visual C# Change the BackGround Color of a Window or Control.
Is there a way with the API functions to change the background color of a Window (or control) having only its Handle Not only the background color behind the text, rather all the window or control, and without changing the original content. Something as: System.Windows.Forms. Control ctrl; ctrl.BackColor = Color .Red; But, With API Functions. Thanks, Deza There is no API that works for all types of windows. The standard Windows Controls (Edit, List Box etc..) send WM_CTRLCOLOR notification messages to it's parent. By handling these type of messages, you can specify how the control gets drawn. ...Show All
Windows Forms Images vs Byte arrays
I have an Access database, that stores image files in a field of one of its tables. Now, I want to show those images in a PictureBox. I use the following code for it : Private Sub ShowPic() 'Connection String is properly initialized in the form's constructor. Dim con As New OleDb.OleDbConnection(ConnectionString) con.Open() Dim query As String = "Select Photo from Member where MemberID='F23';" Dim command As New OleDb.OleDbCommand(query, con) Dim arrImage As Byte() = command.ExecuteScalar() Dim ms As New System.IO.MemoryStream(arrImage) 'The following command generates an exception PictureBox1.Image = Drawing.Image.FromStream(ms) ms.Close() con.Clos ...Show All
Visual Studio Tools for Office ASP.NET and Word
I need some design guidance. I currently have an asp.net application that has some word documents that are used as templates and are stored in xml wordml format. I use standard XML processing to replace various parts of the document then send the processed XML document out in the response stream. This works great if the user has Word 2003 installed but now have to find a solution to support other versions of Word, etc. I began to think I could simply keep most of the processing the same (processing a WordML document) but instead of sending the WordML format document to the client have the document first converted to a standard word doc on the server then send to the client. I thought this may help me get around the incompatibilities wit ...Show All
.NET Development simple data readting question
I have done some searching with no luck.. perhaps this is so simple I am the only one that doesnt get it! I need to read data from a XLS file(spreadsheet). I have read about using excel to open the sheet, then reading it.. but I would like to just read the data with out opening excel. IE< i want to read A3 to A25 and save it to an array. I need no other manipulation other than simply reading several different columns and and saving them to an array, so I dont see a need to have my VBA open excel.. Any pointers here I am a total newb. Mechanical Engineer with a software project I want to do. thanks! easily done my friend. the Statement would be: "SELECT * FROM [SheetName$A3:A25]" ...Show All
.NET Development How to extract enum strings
Say you have an old-fashioned C/C++ enum like this from a 3rd party public header file: typedef enum { NOERROR = 0, FAULT1, FAULT2 } ErrorType; How can I extract string representations of the enum's members (i.e. "NOERROR", "FAULT1", & "FAULT2") from a clr/.net based application (in C++ or C#) If the enum was defined as a managed 'enum class' then I would be able to call Enum::GetNames() to get the strings, but it's not clear how to create an enum class and associate it with a pre-defined legacy enum like this. Seems like the TypeConverter or EnumConverter classes should help, but I could use some help with the implementation. Thanks. Thanks for the resp ...Show All
