|
|
i completed one project in vb.net with msacess database.... the problem is when i came to publish the project i clicked publish from menu ........ the problem is i can't add my msacess database setup.exe file.... thats why i can't publish my project .... i need answer for my query....
|
|
|
|
|
|
I have a big file in witch i wanted to find a hex value. The hex value contains several values, for example D274D274. Can anyone help me
|
|
|
|
|
So what have you written?? This is easy enough to do. Just read the file byte-by-byte until you find the first byte in the value you're looking for. Then compare the next byte in the file to the next byte in the value. If they match, do it again on the next byte. If not, keep looking for the first byte in the value until you find it again.
|
|
|
|
|
I would like to know how to detect a video card in a splash screen and then write the values to the registry. After closing the main form and rebooting it, all the splash screen has to do then is check the registry settings and exit and display the main form.
rspercy
1 + 1 = 186,440....Depending on the species.
|
|
|
|
|
Why would you want to check the video card?? You can't get at it directly, or the closest you're going to get with that is through DirectX. What are you checking for??
|
|
|
|
|
All I want to know if it is ATI, NVidia, or some other brand. I do not want to access the card itself. THNX for such a quick response.
rspercy
1 + 1 = 186,440....Depending on the species.
|
|
|
|
|
You can use the System.Management namespace and it's classes to get all instances of the Win32_VideoController WMI class. This will give you the manufacturer and model of all the video controllers in the system. Careful, you may be surprised at what you find.
|
|
|
|
|
WOW, a lot of stuff. Anyway, Thats what I was looking for. THNX a lot for your expertise on this subject.
rspercy
1 + 1 = 186,440....Depending on the species.
|
|
|
|
|
I want to export to XML file and have problem this is the code but is not work, error is "No value given for one or more required parameters."
Private Sub GetDataFromAcessFile1()
Dim aCon As OleDbConnection
Dim aCmd As OleDbCommand
Dim strCon As String
Dim param1 As OleDbParameter
Dim param2 As OleDbParameter
Dim param3 As OleDbParameter
'create connection with mdb file
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strAcessFilePath & ";User ID=Admin;Password="
aCon = New OleDbConnection(strCon)
aCon.Open()
strQuery = "Select * from rabotnici where rabotnik_name=? and data_rabota>=? and data_rabota<=?"
param1 = New OleDbParameter("@rabotnik_name", OleDbType.VarWChar, 100)
param1.Value = ComboBox1.Text
param2 = New OleDbParameter("@data_rabota", OleDbType.Date)
param2.Value = DateTimePicker1.Value.ToShortDateString
param3 = New OleDbParameter("@data_rabota1", OleDbType.Date)
param3.Value = DateTimePicker2.Value.ToShortDateString()
aCmd = New OleDbCommand(strQuery, aCon)
aCmd.Parameters.Add(param1)
aCmd.Parameters.Add(param2)
aCmd.Parameters.Add(param3)
aCmd.ExecuteNonQuery()
aCmd = New OleDbCommand(strQuery, aCon)
Dim da As New OleDbDataAdapter
da.SelectCommand = aCmd
Dim ds As DataSet
ds = New DataSet("Customers1")
da.Fill(ds, "New Customers1")
Dim dt As DataTable
dt = New DataTable()
dt = ds.Tables("New Customers1")
CreateXMLFile()
WriteToXml(dt)
aCon.Close()
End Sub
Can You help me
|
|
|
|
|
See if this works:
Select * from rabotnici where rabotnik_name = @rabotnik_name and data_rabota >= @data_rabota and data_rabota <= @data_rabota1
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I try this but also not work again this error
|
|
|
|
|
Access (Jet) doesn't use named parameters, only question marks. You have to specifiy the parameters values in the order the question marks show up in the SQL statement.
|
|
|
|
|
Now that I am looking at this a little closer.
ivo75 wrote:
aCmd.Parameters.Add(param1)
aCmd.Parameters.Add(param2)
aCmd.Parameters.Add(param3)
aCmd.ExecuteNonQuery()
This is wrong since this is a query (select * from = a query).
ivo75 wrote:
aCmd = New OleDbCommand(strQuery, aCon)
Dim da As New OleDbDataAdapter
da.SelectCommand = aCmd
strQuery didn't get changed.....should this command be the same as the first cmd? What is the purpose of the first command?
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Few comments:
- when doing select, don't use ExecuteNonQuery. Use for example ExecuteReader. However, since you later use adapter.fill you dont't need to execute anything at that point
- when assigning values to the parameters, don't modify their datatype unless the datatype in database is different. So instead of param2.Value = DateTimePicker1.Value.ToShortDateString use param2.Value = DateTimePicker1.Value
- also you created a new command and used it instead of the command where you added the parameters
So your code could be something like:
...
strQuery = "Select * from rabotnici where rabotnik_name=? and data_rabota>=? and data_rabota<=?"
param1 = New OleDbParameter("@rabotnik_name", OleDbType.VarWChar, 100)
param1.Value = ComboBox1.Text
param2 = New OleDbParameter("@data_rabota", OleDbType.Date)
param2.Value = DateTimePicker1.Value
param3 = New OleDbParameter("@data_rabota1", OleDbType.Date)
param3.Value = DateTimePicker2.Value
aCmd = New OleDbCommand(strQuery, aCon)
aCmd.Parameters.Add(param1)
aCmd.Parameters.Add(param2)
aCmd.Parameters.Add(param3)
Dim da As New OleDbDataAdapter
da.SelectCommand = aCmd
Dim ds As DataSet
ds = New DataSet("Customers1")
da.Fill(ds, "New Customers1")
...
|
|
|
|
|
Hi, advice on the use of Private Properties required (please!).
In my aplication I have classes which have variables which can be read by but not changed by other classes via Public ReadOnly Properties. Now, should the values of these variables be set within the class using Private WriteOnly properties or is it OK to directly assign to the variable?
Thanks in advance for your time.
|
|
|
|
|
I think it's partly a matter of coding style. If you just assign the value, it's simpler (and a bit more efficient) to use the field directly.
However, if you have (or you're likely going to have) somekind of logic in the assignment, it's better to use a property (or a method). For example, when assigning a value to a field, you raise and event, do some calculation, check the value etc. it would be better to have a property.
|
|
|
|
|
Cool, thanks Mika
|
|
|
|
|
No problem Hopefully others will share their opinions too.
|
|
|
|
|
Due to a recent hard to find problem with this same scenario, I switched to using properties exclusively for setting variable values (per recommendation of Dave K).
It's a couple more lines of code and very minimal time to just break it out. Even if your code for now doesn't have any extra checks/logic before setting the value and it's module/class scope, you could easily expand the property to add checks in the future. It also helps in determining when a variable gets a value that is not expected.
In VB6, you could create and set a global breakpoint to "break" when the variable is set = to the value your looking for. That type of global break point doesn't exist in VB.Net. If your variable is set using a property, then you can indeed easily do this without breakpointing everywhere the variable is being set.
As you mentioned, you can have mix match of scope within the property itself.
Performance wise, unless your doing something off the wall like a trillion loops with reading/setting values, you are not going to have a performance issue; otherwise, you might want to access the variable directly in these rarer cases (like Mike discussed).
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
OK, thanks Jon_Boy. Like Mika suggested, this sounds like a matter of coding style, but I do actually like the idea of using properties to set object wide variables. After all, I use properties to set some variables but then directly assign others, so using properties to set all variables will at least ensure consistency, which I like.
Thanks for your time
|
|
|
|
|
The reason I told him that little trick is because occasionally you run into a problem where a value is set in a class, but you can't find where the value is being set from. Using a private property, you can set a breakpoint in the setter code, then look at the stack trace to see exactly where the value came from.
|
|
|
|
|
I did try to search (albeit quick) for my orig post yesterday, but couldn't find it. oh well...
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hi I'm stuck on this problem I have with the webbrowser control. I am trying to print a html doc that has been loaded into the control like follows
html.Navigate(New System.Uri(fileName))
html.Show()
html.Width = 800
html.Height = 600
html.Refresh()
and then print it using
html.print
but nothing happens. Does anyone know why
Stephen Lintott Bsc IT (RAU)
|
|
|
|