|
I use a standard select for all table (created by a codebuilder app I built) with the following.
AuditTypeID is the identity field on the table
ALTER Proc [dbo].[AuditTypeSelect]<br />
--Declare<br />
@AuditTypeID as int<br />
<br />
AS<br />
<br />
Select *<br />
From AuditType<br />
Where (IsNull(@AuditTypeID, -1) = -1 OR AuditTypeID = @AuditTypeID)<br />
Order By AuditType
This returns 3 table types based om the value of @AuditTypeID
@AuditTypeID = -1 returns every record in the table
@AuditTypeID = 0 returns an empty table ready for data entry
@AuditTypeID = ## returns 1 record matching ##
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
no, sorry but i cant get that too work.. my data adaptor name is "daSession" and the feild to filter is "Sim_code".. im trying to use this same Data adaptor for two queries, in one query i wish it to display all sim_code in the table...
i'm a little green with this and willing to learn, so a little push would be appreciated..
Colin
Microsoft Visual Basic .NET (2003) version 7.1.6030
Microsoft .NET Framework 1.1
|
|
|
|
|
Assuming that sim_code is a numeric, you need to pass a parameter to your stored proc (@sim_code|@instructor)
If you change this proc so
AuditType = your table name
AuditTypeID = sim_code
@AuditTypeID = @sim_code
ALTER Proc [dbo].[AuditTypeSelect]<br />
--Declare<br />
@AuditTypeID as int<br />
<br />
AS<br />
<br />
Select *<br />
From AuditType<br />
Where (IsNull(@AuditTypeID, -1) = -1 OR AuditTypeID = @AuditTypeID)<br />
Order By AuditType
Then test it with the values -1, 0 and 13
BTW
You are going to cause confusion all round if you change the var names all the time. If you are filtering Sim_Code then you should call the var @Sim_Code not instructor
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
does this work in vb.net 2003, i cant seem to get the code excepted, unless im barking up the wrong tree.
Im starting to think it cant be done..
in my data adaptor i have a critera for Instructor set as =? and the StartDate criteria as >=?
so i need to send it some sort of wildcard to allow the dataset to return all the instructors greater than the StartDate, as im also filter in out StartTime. do i need to remove the filer commands from the data adaptor to allow this code to work?
maybe I'm just in over my head
Microsoft Visual Basic .NET (2003) version 7.1.6030
Microsoft .NET Framework 1.1
|
|
|
|
|
coldude wrote: Im starting to think it cant be done..
Rubbish - it's just hard work to start with, every accomplished developer does this in their sleep!
You may be in the situation where you are trying to make 1 procedure do 2 tasks, a filtered list and the total table.
I assume you have control of the stored proc and can identify the parameter names (instructor and start date)
Write and test the stored proc so that it returns the results you expect passing in various values for the parameters. Do this in the database ui (management studio for SQL Server). If you don't have a ui for the database get one NOW.
If you cannot get the results from 1 proc then write 2, you can always eliminate 1 when you learn more (remembering to eliminate it is the real challenge )
Now you can replace the ? with the values you expect.
Also look into creating a Data Access Layer (DAL) CP has many examples of these.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi!
I want the page to stay in same page if there is any exception and if there are none i would want it to direct to another page. how could i achieve this? please help
|
|
|
|
|
Sounds like an ASP.NET question to me. Use validators. And next time ask in the right place.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i want to know how to read the content of a http posted file using stream reader i am using the folloing line but an error in the last line sayin that " 'System.IO.Stream' cannot be converted to 'System.IO.StreamReader'."
fileupload1 is the name of the command button there in the tool box
Dim str As StreamReader
Dim hp As HttpPostedFile
hp = FileUpload1.PostedFile
str = hp.InputStream
SAJAN A PILLAI
C#.NET Programmer
TELESOFT INDIA PVT LTD...
BANGALORE
"Winners don't do different things. They do things differently. ...
|
|
|
|
|
sajan ss wrote: 'System.IO.Stream' cannot be converted to 'System.IO.StreamReader'."
I guess that means you've got the wrong variable type. Use a Stream instead, or use it in place. I believe you will find it has a Read and a Write method.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am developing an embedded C application for a small microcontroller. One thing I have found useful in the past was to write a DOS-based PC front end which would simulate the main aspects of the target environment. I would thus have three pieces of code:
-1- The common code, which would run identically on the PC and in the final application, thus allowing it to be debugged on the PC.
-2- The PC-side code for routines like get_time_of_day(), set_time_of_day(), switch_motor(), check_switch(), etc. would virtualize them as appropriate. The user could turn switches on and off via the keyboard, as well as adjust the relationship between real time and the time reported to the application. Hardware functions like motors would be displayed on screen.
-3- The microcontroller code for those routines would perform them on real hardware.
Previously, I've used Turbo C for DOS to do the PC front end, but that's rather clunky. I'd like to migrate to using Windows. I've done a little Windows programming in C, but it would seem like it would be more convenient to have a vb.net application maintain the user interface and have it communicate somehow with a C application which would simulate the microcontroller.
I wouldn't be looking to do a super-detailed hardware simulation, but rather a more general one (e.g. I'd use a PC version of the get_time_of_day() function to simulate getting time of day, rather than trying to write a PC function to simulate pulsing the processor pins necessary to communicate with the real-time clock chip).
Has anyone done anything similar, or can anyone offer any advice? Two notable ceaveats:
-1- It would not be acceptable for the VB program to simply call a C function which would have to completely finish execution before control could return to VB, but...
-2- It would be acceptable to have the C application only yield control during its own check_event() and wait_event() procedures. I don't feel a need to simulate interrupts and other such features.
The first requirement would suggest that simply using a DLL would probably not work well, unless I used multi-threading and had a means for threads to communicate. Having applications that share messages with each other would seem a better solution.
|
|
|
|
|
Vb.net has a built in control called serial port (I'm not sure if they have one for usb). If you have a microcontroller that can interface with a serial port then you could send messages between your pc and microcontroller with a serial port (just make sure your settings match on each side). Just write some code in each program to interrepret the messages and data so each program can act accordingly.
hope this helps,
Mike
|
|
|
|
|
Perhaps I didn't make myself clear. My goal is to, during development, run on the PC the same source code that will be run on the target device, but with some different libraries to handle the I/O. I will also be wanting to have the PC talk to a real device, but that would come later.
The compile/build/execute cycle for PC code is much faster on the combile/build/burn/execute cycle necessary for an embedded system. Further, it's much easier to monitor the internal workings of a PC app than an embedded one. Perhaps I should use an ICE for development, but I've never had much luck with them.
As I think about things some more, it may be better to do the whole simulation thing in C; if I want to simulate the device talking to the PC, since the end-user application for that purpose will probably be written in VB, I could perhaps code the simulation app so that it would some bizarre TCP port at 127.0.0.1 was its serial port and then let the end-user app talk to it that way.
On the other hand, since the target system is in fact comprised of multiple processors (most of which will have fairly simple code), having the code run stubs on a PC that simply exchange TCP information on port 127.0.0.1 with a VB front end might not work too badly either. The one annoyance would be that I currently have a decent-looking version of the LCD coded in C (the C code was written for the purpose of generating the design to get the real custom LCD manufactured, but it can draw the display with selected segments enabled or disabled) and that would have to be redone for VB, but otherwise VB might be nicer.
modified on Tuesday, February 05, 2008 2:32:33 PM
|
|
|
|
|
I am using an update panel which updates the datagrid when the button is clicked. How do i update it automatically (every 3 seconds) instead of clicking the button.
many thanks
|
|
|
|
|
This is an ASP.NET question, please ask it in the right forum.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi all
i have an quick Project i must do for a Client, is it advisable to use a Stored Procedure for Access as a Backend, and how is that Compiled, i always do sql, OR SHOULD I use naked SQl ?
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Just to be clear, do you want stored procedures for Access as the backend database, or are you using Access as a front-end to a SQL Database?
If you want stored procedures for Access, then you cannot. The closest you will get is to use a Query, which is effectively the same as an SQL View.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Thanks you, that means i wil use a naked SQL , a Query .
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Access doesn't support stored procedures.
It does support stored queries, if that is enough for your purposes. (It's basically a stored procedure that is limited to a single query, and has no other featuers like flow control commands.)
As such, stored queries doesn't add much, so it's mostly a matter of taste if you want to use them or not.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Hi there VB Pros i'm doing a project that requires to encrypt and decrypt files.
I need to create this algo from scratch.
Anyone has any clues as to how to do that??
|
|
|
|
|
How complex does it have to be?
You could use a simple character replacement method, based on a string provided by the user or some other source.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Got your message. Does not have to be complex a simple encryption algorithm to encrypt and decrypt files.
The button sub routine will contain the algo when the user clicks the button the file gets encrypted.
|
|
|
|
|
Where does the requirement that you do it from scratch come from? Its 99.99% likely that if you write your own algorithm it won't last 15 minutes of cryptanalysis....
|
|
|
|
|
wantta know how to solve this problem!!!!
xlApp = New Excel.Application
xlBook = xlApp.Workbooks.Add
when added workbooks to excel application
this error occour..
"Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))"
|
|
|
|
|
Hi,
I also got this error, when i try to run my already created application on my friends PC, the problem is he has the Office 2000 in his pc installed.
Do one thing uninstall the office from your pc and install the XP or higher version of office.
Hope this will help you.
with regards
Yogesh Agarwal
|
|
|
|
|
thanks alot for u advice..
yes, it is cause of my excel is old version..
now upgrade to office2003.. it is ok...
|
|
|
|