|
Dave Kreskowiak wrote: SHORTEN YOUR NAME!
Most irritating thing I have seen today
|
|
|
|
|
I have a pretty big program that I am developing. There are 2 different forms in the program. One of the forms has several panels on it and each panel has a form, or several forms.
I had all of my queries coming from one dataSet but I had problems with conflicting dataTables. Then I created another dataSet for a couple of my list boxes and then it worked. Then I Tried to create 2 different dataSets for one of my panels. One of the dataSets included the database tables and fields that were needed to fill list and combo boxes with info and the other with the profile and schedule info. When I did this suddenly my form is glitchy. When I get the query from the original dataset it works fine, but when I get the query from the new dataset it does not work.
What is the best way to design the datasets for a program to avoid these kinds of problems.
Should I use multiple datasets?
Would it be better for me to use a getData method instead of a fill method instead of using different datasets.
|
|
|
|
|
basically dataset is collection of datatable and it is always better to work with data table in such cases.. so please try to fetch data in minimum number of dataset (possibly one dataset). tehn bind the controls with various datatables...this will work in most cases...
Ashish Sehajpal
|
|
|
|
|
I generally do the opposite of what Ashish recommends. Get each table as data discreet entity (1 table per dataset)
I use 2 types of data, static for lookup lists etc and transactional. The static tables I populate the first time they are used and remain in memory. These are in a class called MasterTables eg
'Local var to hold the table<br />
Private mvApp As DataTable<br />
<br />
'Public property to expose the table<br />
Public Property App() As DataTable<br />
Get<br />
If mvApp Is Nothing Then<br />
mvApp = LoadApp()<br />
End If<br />
Return mvApp<br />
End Get<br />
Set(ByVal Value As DataTable)<br />
'this allows the system to reload the table when the value is nothing<br />
mvApp = Value<br />
End Set<br />
End Property<br />
<br />
Private Function LoadApp() As DataTable<br />
' Load the app table from the database<br />
Dim oClass As New clsApp<br />
Return oClass.GetRecord(cAllRecords)<br />
End Function
Note if you use a dataview to filter a table (when populating a list) then this can be reflected in the base table unless you copy the table.
|
|
|
|
|
I want to Write a program that lists all current installed services (running and stopped),the program should be able to stop/start/Pause/Resume/remove any service. Also the program should display the path of the service executable and its description
How Can i start?
|
|
|
|
|
You can start by reading all of the documentation on the ServiceController class[^]. That means reading all of the docs on all of those properties and methods because you're going to need just about all of them to do this project.
|
|
|
|
|
I am working with vb.net 2005 so there are many function is not exsit in vb.net 2005 as stop() as and start
Ahmed hassan
|
|
|
|
|
My VS2005 knows about ServiceController.Start() and Stop() ...
of course you need to add:
a reference to System.ServiceProcess
and an Imports System.ServiceProcess line
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
What is the best way to store a small amount of data that the user does not have access to? I don't want to have to worry about licensing. Just need to store data from a listbox that is retrieved on startup.
I mainly work with a SQL server 2005 backend that has tens of thousands of entries. I am developing my own app that I would like to distribute.
Mark Thibodeaux
|
|
|
|
|
Your question isn't very clear. Are you saying that this application uses an SQL Server or you application needs one and you're looking for a smallish SQL Server?? Or, are you looking to store a small amount of information somewhere and you want to know the best place to put it??
|
|
|
|
|
the latter, looking to store data, need to know where to put it. I was trying to explain at my job I work with large amounts of data, don't know much about storing small amounts of data.
Mark Thibodeaux
|
|
|
|
|
In that case, I'd say store the data as an XML file in the users Application Data folder. If you need to store the data for multiple users on the same machine, use the Common Application Data folder.
You can build the path to the file using the Environment.GetFolderPath[^] method using an appropriate SpecialFolder[^] enum value and the Path.Combine[^] method.
There are various methods for building a XML file, from using XmlDocument to file stream methods to the very easy DataSet/DataTable WriteXml methods.
|
|
|
|
|
tibmark wrote: What is the best way to store a small amount of data that the user does not have access to
In the file system, for the user to be able to save the data somewhere they must have access (permissions) to it. I'd suggest making a directory for your program under the user's "Application Data" directory. (Could also use the user's registry if the number of list items isn't too excessive.)
I guess you could encrypt the files' contents or registry keys if you really didn't want the user to be able to read the files outside your program.
|
|
|
|
|
what kind of file? .txt?
Mark Thibodeaux
|
|
|
|
|
You can store as a config or an xml by the sound of what you want to do.
|
|
|
|
|
I am having trouble figuring out how to validate some dates. I have to read them in from an excel file and put the into access. The problem is if a null value is entered for a date in the excel file. null values are allowed int the db but I can't pass them through my "insert command". Any suggestions?
All help is welcome
Insert code below:
Sub IncidentReportAdd(ByVal IncNo As String, ByVal IncType As String, ByVal estate As String, _
ByVal MTI As System.DateTime, ByVal INATT As System.DateTime, _
ByVal stopTime As System.DateTime, ByVal MAV As System.DateTime, ---etc....)
Dim cmd As OleDbCommand = New OleDbCommand()
Dim paramContNo As New OleDbParameter()
Dim paramIncDescription As New OleDbParameter()
Dim paramAdd1 As New OleDbParameter()
etc...
With paramContNo
.ParameterName = "ContNo"
.OleDbType = OleDbType.Double
.Size = 4
.Value = splitCont.GetValue(1)
End With
cmd.Parameters.Add(paramContNo)
With paramTimeStop
.ParameterName = "Stop"
.OleDbType = OleDbType..Value = stopTime
End With
cmd.Parameters.Add(paramTimeStop)
Dim param As OleDbParameter
For Each param In cmd.Parameters
If param.OleDbType = OleDbType.VarChar Then
If param.Value = "" Then
param.Value = "null"
End If
End If
Next
'execute command
cmd.CommandText = "EXECUTE ActivityBufferInsert"
con.Open()
cmd.ExecuteNonQuery()
con.Close()
>>
>>the code is called here:
>>
MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;" _
& "data source=" & e.FullPath & "; " & "Extended Properties=Excel 8.0;")
Dim DtSet As New DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
' Select the data from Sheet1 of the workbook.
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [sheet1$]", MyConnection)
MyCommand.Fill(DtSet, "ExcelFields")
MyConnection.Close()
Dim ir As New DBTier
Dim dr As DataRow
For Each dr In DtSet.Tables("ExcelFields").Rows()
ir.IncidentReportAdd(dr.ItemArray(0).ToString(), dr.ItemArray(1).ToString(), _
dr.ItemArray(5).ToString(), dr.ItemArray(7).ToString(), dr.ItemArray(2).ToString(), _
dr.ItemArray(8).ToString(), dr.ItemArray(10).ToString(), dr.ItemArray(12).ToString(), _
Date.Parse(dr.ItemArray(13).ToString()), Date.Parse(dr.ItemArray(14).ToString()), _
Date.Parse(dr.ItemArray(15).ToString()), Date.Parse(dr.ItemArray(16).ToString()), _
Date.Parse(dr.ItemArray(18).ToString()), Date.Parse(dr.ItemArray(19).ToString()), _
dr.ItemArray(21).ToString())
Next
I know it's a lot to read through but any help would be greatly appreciated.
|
|
|
|
|
Well, you're biggest problem is that teh .NET 2.0 DateTime type is a structure, not a class, and therefore cannot ever be Nothing (null in C#). So, Date.Parse will fail when trying to parse String.Empty or any invalid date representation (including Nothing) into a Date value.
You're going to have to provide code that you can call with a value from each column from your Excel data that returns either a correct Date object or returns a DBNull value, possibly using Date's TryParse method. The existing Date structure methods won't do this for you.
You also have a problem with your database table using a string to represent a Date instead of the database's native DateTime type for a column. You'll have to rewrite your IncidentReportAdd method to accept Date objects instead of strings representing dates.
|
|
|
|
|
I am using VS2005, .net framework 2.0. The program is used to collect and display data from a uSB DAQ. I created the installation file using Inno SetUP. I can install and run the program on any Vista machine without any problem. If I try to run this program on XP machine, it comes up with a general error:
"MyApplication" has encountered a problem and needs to close. We are sorry for the inconvenience.
It installs without any probem, the error comes up when i run the application.
If I copy and run the same program on a XP machine and create an installation file, use this file to install the program on XP computer, it runs just fine.
Does that mean I cannot develop programs on Vista and distribute it to XP customers?
|
|
|
|
|
Chun2 wrote: Does that mean I cannot develop programs on Vista and distribute it to XP customers?
No, it doesn't. Somewhere along the line, the generated installation is missing something. You may want to ask the InnoSetup people about this.
|
|
|
|
|
Dave, Thanks for your response.
I did "build solution", then copied all the files in MyApplication\...bin\release folder from Vista machine to XP machine, run the MyApplication.exe file and got the same error. Then I tried the same with MyApplication\...bin\debug folder. Same error. If the application is developed on XP machine and I copy bin\release folder to another XP machine, the program runs just fine. The error comes up when the files are copied from Vista to XP computer.
So, I dont think it the error is linked to inno setup. Do you have any suggestions on how to solve this problem. How can I distribute my application developed on Vista to XP customers?
|
|
|
|
|
Chun2 wrote: I did "build solution", then copied all the files in MyApplication\...bin\release folder from Vista machine to XP machine, run the MyApplication.exe file and got the same error. Then I tried the same with MyApplication\...bin\debug folder. Same error. If the application is developed on XP machine and I copy bin\release folder to another XP machine, the program runs just fine. The error comes up when the files are copied from Vista to XP computer.
OK. That's not what your original post implied.
If you've copied the entire Debug folder over to the XP machine, it should have worked. Does the code compiled on XP and copied over to Vista work?? Is either one of these machines a 64-bit copy of Windows? Do all machines involved (XP and Vista) have .NET Framework 2.0 Service Pack 1 installed??
|
|
|
|
|
I tried copying the folders after you suggest that problem may be with Inno Setup.
If I copy the entire bin\debug folder from XP to Vista, the application runs without any problem.
I am using 3 computers. 1) One laptop with XP home - for testing the application developed on XP and Vista. 2) A Desktop with XP pro and VS 2005 installed. 3) The laptop which I use for developing applications. It has Vista Business edition and VS 2005.
All computers have 32-bit copy of windows.
I checked in Add/remove programs and verified that I have .net 2.0 with SP1 on both XP machines.
Surprisingly, I could not find .net 2.0 SP1 on Vista laptop! I assumed that If I have VS2005 and my program requires .net 2.0 to run, I would have .net 2.0. Also, the installation file I created, automatically install .net 2.0, if it was not installed already. So I think it must be installed on Vista machine, but I cant find it!
Do I need to install .net 2.0 sp1 on vista machine.. i m confused.
How can I run application developed on XP with .net 2.0 sp1 on Vista machine if it doesnot have .net 2.0?
modified on Friday, April 4, 2008 1:28 PM
|
|
|
|
|
If you're running Visaul Studio 2005, you MUST have the .NET Framework 2.0 installed as well. VS2005 won't run without it. The question is do you have Service Pack 1 for .NET 2.0 installed??
|
|
|
|
|
No, I don't have SP1. I cannot find Service Pack 1 for .net 2.0 for Vista on the internet.
1)Do I need to install 3.5 framework which comes with .net 2.0 sp1 for vista
2)I came across "Microsoft® Visual Studio® 2005 Express Editions Service Pack 1", is it necessary to install this SP too?
modified on Friday, April 4, 2008 2:34 PM
|
|
|
|
|
Chun2 wrote: No, I don't have SP1. I cannot find Service Pack 1 for .net 2.0 on Vista.
It's not "for Vista", it's for the .NET Framework 2.0. Here[^]
Chun2 wrote: 1)Do I need to install 3.5 framework which comes with .net sp1 for vista
No.
Chun2 wrote: which comes with .net sp1 for vista
There's no such thing as ".net sp1 for Vista".
Chun2 wrote: 2)I came across "Microsoft® Visual Studio® 2005 Express Editions Service Pack 1", is it necessary to install this SP?
No. That's the service pack for Visual Studio 2005 Express. It has nothing to do with Vista or .NET 2.0.
*** UPDATE ***
It turns out that the reason the normal SP1 pack won't work on Vista is because Vista uses a different Update installation engine. Installing .NET Framework 3.5[^] also installs the SP1 for .NET 2.0, as well as .NET 3.0 with it's SP1. That link downloads the installer that works on Vista.
What a pain...
|
|
|
|