Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how find records in database in vb.net?
i try in this code
VB
ds.clear
da=new sqldataadapter("SELECT * FROM members WHERE name=" & textbox1.text &"", dbconn)
try
   da.fill(ds,members)
   bind()
catch ex as exception
   mesaagebox.show(ex.message)
   exit sub
end try

sub bind()
   lable1.databindings.add("text",ds,"members.name")
end sub
then i got. erro msg like that 'invalied column name'
but column is in database.
please correct this code.please
thank
then i try search by there telephone no. its work.
when i enter string value for search box display erlier time erro message
Posted
Updated 5-Feb-12 22:56pm
v4
Comments
Rajeev Jayaram 6-Feb-12 5:18am    
Start here, http://archive.msdn.microsoft.com/SQLTutorials
manognya kota 6-Feb-12 5:46am    
Try parameterising your query.

http://msdn.microsoft.com/en-us/library/bbw6zyha.aspx

1 solution

Hi Amal,

As per my understanding,when you are binding the dataset to the label, the column name "memname" is not present in the dataset "members".Correct me if iam missing anything.

Suggestion: When you are using a where condition, assign the textbox.text value to a variable and compare like upper(columnname)=upper(txtboxvalue) , if you are not looking at case sensitive comparision.
 
Share this answer
 
v2
Comments
Amal anjula 6-Feb-12 4:27am    
no, memname mean column name of name of the membera.
manognya kota 6-Feb-12 4:29am    
is that 'memname' column present in the database?You cannot give custom column name while binding.Instead in your select you can customise your column names.
Amal anjula 6-Feb-12 4:37am    
can u correct my code please
manognya kota 6-Feb-12 4:38am    
The data binding what you are doing to the label needs a column name that is in the dataset.Put a breakpoint at your dataset and check whether you are having any column with the name 'memname'?
manognya kota 6-Feb-12 4:40am    
On label binding , give the exact database column name what is present in the table.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900