I am currently trying to get the text from a DBLookUpComboBox but it wont let me retrieve it i have a number and 2 strings in the box which is an ID and first and last name. I cannot retrieve anything from the box unless i use a edit box but i cannot imput it into a database which is using the type number.
Please help if you need more info or example of the code i can do this.
HelpMeIT
0
Newbie Poster
Recommended Answers
Jump to PostI am currently trying to get the text from a DBLookUpComboBox but it wont let me retrieve it i have a number and 2 strings in the box which is an ID and first and last name. I cannot retrieve anything from the box unless i use a edit box …
Jump to PostDear My Frind
you can change your code to one of the tow below code
1- Using a String Variableprocedure TForm6.Button1Click(Sender: TObject); Var STD_ID:String; begin STD_ID:=Trim(DBLookupComboBox1.Text); adotable1.Close; with adoquery3 do begin active:=false; SQL.Clear; SQL.Add('insert into StudentPayments(Student_ID)' + 'values(:p1)'); parameters.paramvalues['p1']:=StrToInt(Trim(STD_ID)) ; execSQL; end; adotable1.active:=true; end;
2- Directly Use …
Jump to PostHi,
I haven't used paramvalues till now, so I write my way to do this:
procedure TForm6.Button1Click(Sender: TObject); begin adotable1.Close; with adoquery3 do begin if Active then Close; SQL.Clear; SQL.Add('insert into StudentPayments(Student_ID)' + 'values(:p1)'); if StrToIntDef(DBLookupComboBox1.Text, -1) <> -1 Parameters.ParamByName('p1').Value:= StrToInt(DBLookupComboBox1.Text) //value is a variant, but, …
Jump to PostDear My Friend
your code is Correct But I should hint you tow points
1- When you use SQL Statements(that I think it is a very good method for working by Database) you should better to use MaskEdit Instead Edit Or DBEdit for user interface
2- the error that you …
All 14 Replies
fayyaz
1
Junior Poster in Training
HelpMeIT
0
Newbie Poster
fayyaz
1
Junior Poster in Training
Ionelul
7
Junior Poster in Training
HelpMeIT
0
Newbie Poster
fayyaz
1
Junior Poster in Training
HelpMeIT
0
Newbie Poster
fayyaz
1
Junior Poster in Training
HelpMeIT
0
Newbie Poster
fayyaz
1
Junior Poster in Training
HelpMeIT
0
Newbie Poster
fayyaz
1
Junior Poster in Training
HelpMeIT
0
Newbie Poster
fayyaz
1
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.