-
Expert Member
Display data in datagrid
How to display the data with field - "custname" beginning only with "S" in datagrid
NOTE : [This question was asked by Mudduswamy, I am posting it in proper forum]
-
Expert Member
Re: Display data in datagrid
use the query
SELECT * FROM cust WHERE custname LIKE 's%';
to select custname starting with s.
Fill the dataset with those records and populate the datagrid.
-
Contributing Member
Re: Display data in datagrid
Hi,
I am sending the code for your requirement. First u need to import the System.data.sqlclient namespace.
Write the follwing code in Form_Load
Dim cn as new SqlConnection("connectionstring")
Dim da as new SqlDataAdapter("select custname from customers where custname like 's%'", cn)
Dim ds as new DataSet
da.fill(ds,"customers")
DataGrid1.datasource=ds.tables("customers")
If it is not working please inform to me.....
Regards,
hari prasad
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules