Posts

Showing posts from February 7, 2019

How to search data from textbox and fill specific coloumns of datagridview from sql database?

Image
up vote 0 down vote favorite I am trying to search itemcode by typing in textbox and i want to get specific columns in same row from SQL database. I have made columns with headers in datagridview and i want that searched data in that specific datagridview columns. I have written code but it's not working. I do not know how to do this. I am new and trying to learn vb. Please give some suggestion. This is my code: Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click Using cn As New SqlConnection("server= PANKAJSQLEXPRESS; database = pankaj billing software; integrated security=true") Using cmd2 As New SqlCommand("select itemcode As 'Item Code', item,qty As Quantity, weight as Weight from stockdata Where itemcode = @itemcode;", cn) cmd2.Para