|
You're getting the quiggly line because your tableadapter doesn't have a method called FillBySomething. You have to right-click the methods in dataset designer and click "Add Query...", supplying the SQL statement and options to generate the FillBy... method code.
|
|
|
|
|
Would it be better for me do a bunch of fillBy Methods or to use a binding source?
Wouldn't it slow my program down to do a bunch of FillBy Methods, being that each time I do it is represents a database query?
I have about 14 different combo boxes that all populate from the hours table. The difference between them is that when the user chooses a time in the combbo box they each store that time in the database and then when the user navigates to the store schedule tab the value that was stored in the database is the selected value in the combo box.
Here is tbl_store_sched
create table tbl_store_sched (<br />
ss_id int NOT NULL IDENTITY(51000,1),<br />
store_id int,<br />
ss_day text,<br />
ss_from text,<br />
ss_to text,<br />
primary key(ss_id),<br />
foreign key(store_id) references tbl_store(store_id));
If the user checks the Monday check box. They then will proceed to select a from time and a to time. Once they do this the day "Monday" is stored in the column ss_day and the from and to time are stored in ss_from and ss_to.
|
|
|
|
|
AAGTHosting wrote: Would it be better for me do a bunch of fillBy Methods or to use a binding source?
That depends on what your app does and the design of your app. Noone can tell you either way.
AAGTHosting wrote: Wouldn't it slow my program down to do a bunch of FillBy Methods, being that each time I do it is represents a database query?
If this is what your business rules require, then yes, you put these in.
AAGTHosting wrote: I have about 14 different combo boxes that all populate from the hours table. The difference between them is that when the user chooses a time in the combbo box they each store that time in the database and then when the user navigates to the store schedule tab the value that was stored in the database is the selected value in the combo box.
Here is tbl_store_sched
As for the rest, it looks like you really need to rethink how you're storing data in your tables. If a column is storing only the day of the week, you really don't want to do it using the full name of the day. A number field would do it and take up far less space in the database. Also, you're storing times as string in the database - wrong. Store them as time values, not strings. This will make data retrieval much easier and you'll avoid weird results with sorting and functions.
|
|
|
|
|
If I am going to store a time such as 3:00PM in the database and store it as a time not as a string, should I be using a date time picker? As far as I know the date time picker will not do time only. Right now I am using a combo box that has a list of times to choose from.
Greg
|
|
|
|
|
That doesn't change the fact that you're making a big mistake storing time values as strings in the database.
|
|
|
|
|
Initial Problem:
When Imaging numerous computers, they use the same SigmaTel device - and the DeviceID is the same. However, each different model MUST use a different driver version or the SigmaTel sound driver will not function. (That's messed up! - who wrote these Gateway model drivers!)
So... we're trying to develop a script that recognizes/pulls the DeviceID and Model, then depending on what computer model and DeviceID is found, then the correct driver should be loaded.
The VBS problem: The IF statements do not seem to be reading in the string variables (the objItem.Name). It does not seem to read it and is blank.
Anyone have any suggestions / solutions on this one! Any help is appreciated.
======Code:
On Error Resume Next
strComputer = "."
strName = objItem.Name
Dim objFSO ' File System Object
Dim objShell ' Window Shell Object
Dim ObjExec ' Execute command in Shell
Dim strResult ' Output from command execution
Dim strDeviceID ' Device ID of whatever we've found
Dim strDeviceIDShort ' Four-digit ID of device
Dim strDeviceIDLong
Dim strDeviceDesc ' Text description of device
Dim intNumDevices ' Just in case there's more than one, we'll want to know
Dim arrTemp
Dim strTemp
Dim Counter
Dim strComputers ' Computers this might be
Dim strINFFile ' What INFFile we're going to use
Set objShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystemProduct",,48)
'For Each objItem in colItems
'WScript.Echo "whois:" & objItem.Name
'Next
Wscript.Echo
Wscript.Echo "Looking for unconfigured High-Definition Audio Device..."
Wscript.Sleep 500
set objExec = objShell.Exec("c:\windows\devcon find *HDAUDIO\*")
strResult = objExec.StdOut.ReadAll
if InStr(strResult, "device(s)") <> 0 then
arrTemp = Split(strResult, vbcrlf)
If UBound(arrTemp) > 2 then
For Counter = 0 to (UBound(arrTemp) - 1)
If InStr(arrTemp(Counter), "Audio") <> 0 then
strTemp = arrTemp(Counter)
End if
If InStr(UCase(arrTemp(Counter)), "FOUND") <> 0 then
intNumDevices = CInt(Left(arrTemp(Counter), 1))
End if
Next
Else
strTemp = arrTemp(0)
intNumDevices = CInt(Left(arrTemp(1), 1))
End if
arrTemp = Split(strTemp, ":")
strDeviceIDLong = arrTemp(0)
strDeviceDesc = Trim(arrTemp(1))
arrTemp = Split(strDeviceIDLong, "&")
strDeviceID = arrTemp(0)
strDeviceIDShort = Right(Mid(strDeviceIDLong, InStr(strDeviceIDLong, "DEV_"), 8), 4)
Wscript.Echo "Found " & intNumDevices & " Hi-Def Audio Device(s)."
Wscript.Echo "Gathering information..."
Wscript.Echo
Else
Wscript.Echo "There are no Hi-Def Audio Devices present in the system."
Wscript.Echo "Exiting..."
wscript.Sleep 200
End if
For Each objItem in colItems
Select Case strDeviceIDShort
Case "7680"
strComputers = "Gateway E-4500, E-6610"
If objItem.Name = "E-6610D" then
strINFFile = "C:\Drivers\060Audio\010Sigmatel\070AC97\sthda.inf"
ElseIf objItem.Name = "E-6610" then
strINFFile = "C:\Drivers\060Audio\010Sigmatel\070AC97\sthda.inf"
ElseIf objItem.Name = "E4500" then
strINFFile = "C:\Drivers\060Audio\010Sigmatel\040AC97\sthda.inf"
ElseIf objItem.Name = "E-4500D" then
strINFFile = "C:\Drivers\060Audio\010Sigmatel\040AC97\sthda.inf"
End If
Case "7618"
strComputers = "Gateway E-4610, E-4610D"
strINFFile = "C:\Drivers\060Audio\010Sigmatel\040AC97\sthda.inf"
Case "7634"
strComputers = "Gateway M465, M685, E-100M"
strINFFile = "C:\Drivers\060Audio\010Sigmatel\020AC97\sthda.inf"
Case "7690"
strComputers = "Gateway E-475M, E-100M"
strINFFile = "C:\Drivers\060Audio\010Sigmatel\050AC97\sthda.inf"
Case Else
strComputers = "Unknown computer system"
strINFFile = "Not making any changes."
Wscript.Quit
End Select
Wscript.Sleep 350
Wscript.Echo "Driver Device ID: " & StrDeviceIDShort
Wscript.Echo "Device Description: " & strDeviceDesc
Wscript.Echo "System Device ID: " & strDeviceID
WScript.Echo
WScript.Echo "Possible Systems: " & strComputers
WScript.Echo "Device Driver to use: " & strINFFile
Wscript.Echo
Wscript.Echo "Attempting to update driver..."
WScript.Echo "whois:" & objItem.Name
Next
'WScript.Quit
Set objExec = objShell.Exec("c:\windows\devcon updateni " & strINFFile & " " & strDeviceID)
Wscript.Sleep 5000
strResult = objExec.StdOut.ReadAll
Wscript.Echo strResult
DFG
|
|
|
|
|
The problem could very easily be with WMI. Mmotherboard/machine/device manufacturers are not required to provide any information to WMI about the components. If they do, it's usually not complete information either. It's also entirely possible that some devices from a manufacturer will fill in some of the details and others won't fill in any at all.
|
|
|
|
|
WMI and the script appears to be capturing the name.
After looking at this a little bit further, it appears objItem.Name does not return a "text" string, therefore, our IF compare never produces a match.
Is there a way to get the return value to be read as a text string?
DFG
|
|
|
|
|
That depends on the object returned by Name. It should be a string, but could also be Nothing or some other object. The only way to attempt a conversion is to wrap it in a CStr() function call.
Dim name = CStr(objItem.Name)
|
|
|
|
|
How do I determine the output directory of a project (the place where temporary files are extracted)?
Many thanks!
|
|
|
|
|
Your question doesn't make any sense. A "projects" output, when compiled, ends up in the bin folder under your project's folder.
When an installer unpacks itself, the files can go either in a folder hard coded into the installer, or one of the Temp folders, like C:\TEMP, C:\TMP, C:\Windows\Temp, ...
What are you trying to do with this ability?? Is this code that's running in an installer as a custom action??
|
|
|
|
|
Change it in the project properties, it can dictate which folder the files are stored in, and you can set where you want the compiler to output the debug and exe files
|
|
|
|
|
This one really has me stuck. Like the subject says, I would like to open a word document that is an embedded resource in my vb.net application.
Up to now I have been able to open a new document with automation:
oDoc = oWord.Documents.Add
or open an existing doc on my hard drive:
oDoc = oWord.Documents.Open("path and filename")
I have little clue, however, how to successfully refer to an embedded document and open that with word automation. Ideally, I would like to do this without actually saving the embedded doc to the user's hard drive first (if possible).
Thanks for your help,
Craig
modified on Wednesday, December 05, 2007 11:45:43 AM
|
|
|
|
|
Can't be done. In order for Word to open the document, it MUST be a file on a drive. It does not have the ability to open a file from a resource, nor a .NET stream object.
The only way I could think of that simulates this, would be to come up with your own script that tells your code how to build a new Word document.
|
|
|
|
|
assuming a little different situation, but you´ll get the point:
picBox.Image = My.Resources.ResourceManager.GetObject("smq")
and for writing a ressource to a file:
Dim x() As Byte
Dim bw As New BinaryWriter(New FileStream("c:\fwd.doc", FileMode.CreateNew))
bw.Write(x)
modified on Wednesday, December 05, 2007 12:29:35 PM
|
|
|
|
|
Hi,
Can I connect with visual basic.net to a online server (I have a space on the server with my hosting company, the server has mySQL database on it.)?
The idea was to totally wok online using mySQL server?
Thanks.
|
|
|
|
|
Sure. Exactly how you do that depends entirely on where you're code is going to be running and how your ISP exposes the MySql server to it.
You can get the MySql data providers classes from here[^].
You can also find a pretty good tutorial on using it here[^].
|
|
|
|
|
hi all
I am using vs.net 2003 with access.I Usng <b>Crystal Reports </b>in my project.I made my setup but i don't know which additional files I have to add for crystal repots.Can anyone helpme.When I am Installing app to client machine it get error "KeycodeV32.dll not registerd".Is the probelm is due to setup ???
Plz give me full details how to include crystal reports in setup.
Its urgent.
thanks in advance
poonam
|
|
|
|
|
Hi,
While creating the setup of your application, right click on Application Folder and Add -> Assembly to the Folder.
It will open .NET assemblies window. Select all the crystal-report related assemblies.
When u will build the setup project u will obtain a installer for crystal reports. First install this setup and then install your application.
This should work.
Regards,
Ujjaval Modi
|
|
|
|
|
hi
the error was solved.But I have new problm.When I am deploying the project on client machine all things work good.Only crystal report has a problem.It gives error "Load Report Failed".I wrote the code on CRV
[code]
crv.ReportSource = "..\Reports\enq.rpt"
[/code]
hw can i solve this type of prblm.
poonam
|
|
|
|
|
Hi,
Even I am not much good at crystal reports but even I faced same problem in my application for crystal reports and I learnt to add its Installer, so I helped you out in it.
Regarding this problem, your Logon to database is failing, thts why your report fails to load.
Try this code :
<br />
<br />
dim rptObject as new ReportObject <br />
rptObject.SetDatabaseLogon(username,password)<br />
rptObject.SetDataSource(dataTableObject)<br />
crv.ReportSource = rptObject <br />
<br />
Here rptObject is an object of your "enq.rpt" report.
Regards,
Ujjaval Modi
Manpower moves wrenches, horsepower moves cars, and the power of the mind moves the world.
|
|
|
|
|
Hello All,
I have an application, in which I use also DataGridViews to display data. When the user modifies (delete, modify or add) a column he cann save the data by clicking on a button.
Code :
Private Sub btnToeveoegenBewolkingLicht(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Try
Me.BewolkingBindingSource.EndEdit()
Catch ex As Exception
MessageBox.Show(ex.Message, "Fout bij schrijven data")
End Try
Me.SaveDataBewolking()
Try
Me.LichtBindingSource.EndEdit()
Catch ex As Exception
MessageBox.Show(ex.Message, "Fout bij schrijven data")
End Try
Me.SaveDataLicht()
'ResetControls()
End Sub
In SaveDataBewoling() I check if there are any changes and when so the tableadaper is updated.
Code :
Friend Function SaveDataBewolking() As Integer
'Hier IsUpdating
Dim rowsSaved As Integer = 0
Try
If Me.CarpDataSet.HasChanges Then
rowsSaved = BewolkingTableAdapter.Update(CarpDataSet.Bewolking)
End If
Catch ex As Exception
End Try
Return rowsSaved
End Function
Everything seems to be working OK, but ...... there is no data saved in the files. The new/mod data cann bee seen in the gridview, but the data is not being written to the database.
Maybe one of you cann help me solving this problem. I must be overlooking something but what ?!
Thnxs
|
|
|
|
|
Hello
please can you tell me how you are adding rows in datagrid because i have problem to add the data into the rows every time rows is inserted on to the top index 0 and data is not displayed
|
|
|
|
|
Using the debugger, step through the code in the SaveData... methods, line-by-line. Check to make sure that your If statement with the HasChanges check returns what you think it does. If HasChanges returns false, then you can get the symptoms you're describing.
When you write code, you can not assume you know that every line is doing. You have to verify that each line is behaving like it should, even if you think you know what it's doing.
If HasChanges works, step through the code in the TableAdapters Update method. It's possible that the code doing the update is wrong somehow.
|
|
|
|
|
Hi Dave
Thnxs for your reply.
I am sertain that HasChanges=True. The statement RowsSaved returns the number of rows that have changed, deleted or inserted.
Maybe a foolish question, but the TableAdapter.Update statement, does it directly execute the update of the database?
In my dataset i have an sql-statement that has generated automatically the needed statements for update, inserting etc ....
Thanks
Hans
|
|
|
|
|