|
Am in this Step
"Accepting an input parameter, which needs to be accepted from the user, so the next important Activity is Accepting it from the user and storing it in the string type variable Declared earlier."
Am following a Book instructions and it this is an Example of the Book.
strAuID = Trim(InputBox("Enter Authour ID.:"))
i have Few Questions Based on this Statement.
1)Does the Function Trim ,only works for string Vaiables?
2)Am Accepting User input From a Textbox and here was my code
strNum_key = Trim(txtnumkey)
strExtension = txtextension
strCell_ID = txtcellid
strActual_Extent = txtactualextent
strLis_key = Trim(txtliskey)
strFunc_key = Trim(txtfunckey)
.After i have done this it give me an Error and highlight the above lines, when i comment the first one it highlight the second one and so on.
i need to know what is wrong with my above code compering it with the Example of the Book. Note, all the variables are Well declared,textboxes well named.
Thank you
Vuyiswa
|
|
|
|
|
Trim only works on strings and only returns strings.
Nowhere in your code have you converted a string representation of a number to an actual number.
Dim n As Long
n = Val(Trim(txtnumkey))
This tiny example, of course, doesn't do any validation or handle any errors if the string cannot be converted to a number! This is left up to you.
I highly suggest picking up a book on VB for beginners. I doubt you can find a VB6 book anymore, so you might be forced to move to VB.NET.
|
|
|
|
|
Yes i got the Book and am moving to vb.net,i have a vb6 book,it worked when i Put the "Val". now i got another Error in Appending Parameter.
ComLis_key.Parameters.Append prmLis_key
Parameter Object is improperly defined. Inconsistent or incomplete information was Provided
What Does it mean
Vuyiswa
|
|
|
|
|
1)Does the Function Trim ,only works for string Vaiables? trim is only for strings
2)if this is vb.net then you must specify the property .text
strNum_key = Trim(txtnumkey.text)
|
|
|
|
|
|
my misunderstanding...
thanks
|
|
|
|
|
Everything is now Ok but i have one Problem, please tell me what should i keep in mind, about the following Errors
"Application uses Value of wrong type for the current operation"
This is th errors in vb6
Set prmNum_key = ComNum_key.CreateParameter("Num_Key", adBigInt _
, adParamInput)
Set prmExtension = ComExtension.CreateParameter("Extension", adBigInt _
, adParamInput, , txtextension.Text)
Set prmCell_ID = ComCell_ID.CreateParameter("Cell_ID", adBigInt _
, adParamInput, , txtcellid.Text)
Set prmActual_Extent = ComActual_Extent.CreateParameter("Actual_Extent", adDouble _
, adParamInput, , txtactualextent.Text)
Set prmLis_key = ComLis_key.CreateParameter("Lis_Key", adChar _
, adParamInput, 50, txtliskey.Text)
Set prmFunc_key = ComFunc_key.CreateParameter("Func_key", adBSTR _
, adParamInput, 8, txtfunckey.Text)
Here is my SQl Procedure code
Create Procedure prcInserting @Num_key varchar(10),@Extension int,@Cell_ID int,
@Actual_Extent float,@Lis_key varchar(50), @Func_key varchar(8)
,@Active bit,@Add_date datetime,@Add_User_ID int,@Spatial_ADD_Date datetime
,@Rateable bit,@Non_Discreet_Valid bit
with recompile
as
insert into Propery(Num_key,Extension,Cell_ID,Actual_Extent,Lis_key,Func_key,Active,Add_date,Add_User_ID,Spatial_ADD_Date,Rateable,Non_Discreet_Valid)
values (@Num_key,@Extension,@Cell_ID,@Actual_Extent,@Lis_key, @Func_key,0,getdate(),1,getdate(),0,0)
And its working only in vb, tell me what to keep in mind with insert procedures that are linked to vb for input
Vuyiswa
|
|
|
|
|
Like I keep trying to tell you, you are NOT CONVERTING the data in the textbox's to an appropriate data type!!
A textobx will always return a string. You have to convert that string into a number with the Val function. Then you pass that NUMBER into the parameter:
Dim v As Integer
v = Val(Textbox1.text)
Set preCell_ID = ComCell_ID.CreateParameter("Cell_ID", adBitInt, adParamInput, v)
|
|
|
|
|
Hi all,
in VB2005, how can I asssign the whole object attributes to another object of the same type. For example, if through the code I've assigned the attributes of a DataGridView object (AllowUserToddrows, ...), is there any way to copy them to another Datagridview object?
Thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
I've never had the need to do this, so a litte research is in order...
There's no way to copy a DGV in one line of code, no.
The most correct way to do this would be to put the code that setups up your grid properties into a shared method, then just pass the datagrid object you want setup by refrence. Done. No need to copy the object.
Other than that, you'd have to create a method that takes a DGV ByRef as a parameter, then code it to create a new DGV object, copy all the properties you want from the supplied DGV to the new one, then return the new object as a return value.
[EDIT]
You could probably do this with Reflection though.
-- modified at 12:32 Wednesday 16th May, 2007
|
|
|
|
|
hi,
I want to develop little application for Audio /Video Conferencing System. Presently i have no idea from which point i start.
i require address of some article through which i can learn step by step .
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
There is nothing that will tell you how to do this step-by-step. Applications are built up by putting together smaller parts that support very specific pieces of functionality. Break the problem down into interfacing with a web cam, recording audio, socket communications, and so on. Break each of those down into smaller parts and tackle them.
You can get samples of all these little pieces, just by Googling[^].
|
|
|
|
|
can anyone tell me the sql command for counting number of entries in a table and displaying as integer in textbox
|
|
|
|
|
select count(*) from tablename
Hope that helps.
Ben
|
|
|
|
|
thanks that helped a lot.
can you also help me with this similar query too.
i need to do the same query but search only for entries where in one of the columns there is the letter f as appose to m. but i cant use a text box to enter the f.
this is what i got but gives me the same answer as 'select count(*) from tablename
"Select count(*) from Pupils where Sex LIKE '%" & F & "'"
cheers
|
|
|
|
|
actually dont worry i worked it out for myself
cheers lots
|
|
|
|
|
This depends on the datatype of the "Sex" column and what data is in it. What you have will work, so long as the column is one of the character types and only contains F or M. If there are spaces in the data or other garbage that shouldn't be there, your query is going to have a difficult time picking out the correct rows.
Provided the table was setup correctly and the data was validated before it was written to the table, something like this should work:
SELECT COUNT(Sex) FROM Pupils WHERE Sex='F'
|
|
|
|
|
can anyone tell me how to correct this SQL Query
"SELECT DISTINCT * from Pupils WHERE Surname LIKE% '" & tbSearch.Text & "' "
Syntax error in query expression 'Surname LIKE% 'Lowndes''.
trying to search for data using tbSearch as the search criteria
|
|
|
|
|
"SELECT DISTINCT * from Pupils WHERE Surname LIKE '%" & tbSearch.Text & "' "
|
|
|
|
|
|
I have Created a Procedure , i need to intergrate it with vb6, i know that one. i want to insert these fields into Property table and some of them i want to set them here in the Procedure, help to do that and assigning the value of textbox's in vb6 to the variable in a this Procedure. e.g num_key= txtnumkey. Here is my procedure but i did not finish it because of that part.
Create Procedure prcinserting @Num_key varchar(10),@Extension int,@Cell_ID int,
@Actual_Extent float,@Lis_key varchar(50), @Func_key varchar(8)
,@Active bit,@Add_date datetime,@Add_User_ID int,@Spatial_ADD_Date datetime
,@Rateable bit,Non_Discreet_Valid bit
with recompile
insert into Propery(Num_key,Extension,Cell_ID,Actual_Extent,Lis_key,Func_key,Active,Add_date,Add_User_ID,Spatial_ADD_Date,Rateable,Non_Discreet_Valid,)
values ()
Vuyiswa
|
|
|
|
|
You already did this. The part you missed is that you didn't do any validation of the data in the textbox's before you assigned the values to your parameters. Your code just assumed that all the data will be valid, all the time.
You have to write code that checks the Text property of each textbox, converts it to the correct datatype expected by your parameters, and verify that each value is within acceptable ranges before you assign those values to the parameters.
|
|
|
|
|
Thank you Dave, that one i will Do it, Here is my code for the Procedure but has 1 error. please help me on the VBsite,am i going to create a parameter object for all the variables i have created in SQl and string variables in vb?
Create Procedure prcInserting @Num_key varchar(10),@Extension int,@Cell_ID int,
@Actual_Extent float,@Lis_key varchar(50), @Func_key varchar(8)
,@Active bit,@Add_date datetime,@Add_User_ID int,@Spatial_ADD_Date datetime
,@Rateable bit,@Non_Discreet_Valid bit
with recompile
as
insert into Propery(Num_key,Extension,Cell_ID,Actual_Extent,Lis_key,Func_key,Active,Add_date,Add_User_ID,Spatial_ADD_Date,Rateable,Non_Discreet_Valid,)
values (@Num_key,@Extension,@Cell_ID,
@Actual_Extent,@Lis_key, @Func_key
,0,getdate(),1,getdate()
,0,0)
Vuyiswa
|
|
|
|
|
Thank you Dave i saw my Error, here is the Correct code. Please help me with the VB6 side, am i going to create variables for all the variables declared in the Procedure ? and am i going to create a parameter Object for all variables created ?
Create Procedure prcInserting @Num_key varchar(10),@Extension int,@Cell_ID int,
@Actual_Extent float,@Lis_key varchar(50), @Func_key varchar(8)
,@Active bit,@Add_date datetime,@Add_User_ID int,@Spatial_ADD_Date datetime
,@Rateable bit,@Non_Discreet_Valid bit
with recompile
as
insert into Propery(Num_key,Extension,Cell_ID,Actual_Extent,Lis_key,Func_key,Active,Add_date,Add_User_ID,Spatial_ADD_Date,Rateable,Non_Discreet_Valid)
values (@Num_key,@Extension,@Cell_ID,@Actual_Extent,@Lis_key, @Func_key,0,getdate(),1,getdate(),0,0)
Thanks Man you are a Star, please help me on this one
Vuyiswa
|
|
|
|
|
This question was already answered a few hours ago. My answer isn't going to change. You absolutely NEED to validate the data in the textboxs and convert it to the appropriate types expected by your fields.
Like was said before, you're trying to assign a string to a numeric field, hence the error you're getting. Convert the string in the TextBox to a valid number BEFORE you assign it to your field.
|
|
|
|
|