User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 456,233 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,767 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 425 | Replies: 2
Reply
Join Date: Nov 2007
Posts: 14
Reputation: saravanarajan is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
saravanarajan saravanarajan is offline Offline
Newbie Poster

Plz Help me hurry!

  #1  
Nov 9th, 2007
Hi Everyone,
I have a datagrid, columns name location code,account code,account name(read only),
if i give the account no to check the acc. no in database and also automatically give the
account name in another cell(i.e. account name cell)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2007
Posts: 78
Reputation: manoshailu is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 6
manoshailu's Avatar
manoshailu manoshailu is offline Offline
Junior Poster in Training

Help Re: Plz Help me hurry!

  #2  
Nov 9th, 2007
' while form load bind the data in datagird control
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As SqlConnection = New SqlConnection("server=shailu;uid=sa;pwd=;database=pubs")
Dim sadapt As SqlDataAdapter = New SqlDataAdapter("select * from account", con)
Dim ds As DataSet = New DataSet
sadapt.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub

'Bind the data in datagrid control by accountcode from the user through textbox

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As SqlConnection = New SqlConnection("server=shailu;uid=sa;pwd=;database=pubs")
Dim sadapt As SqlDataAdapter = New SqlDataAdapter("select * from account where accountcode='" & TextBox1.Text & "'", con)
Dim ds As DataSet = New DataSet
sadapt.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub

'While change values in a cell(account code) required data will bind
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
Dim con As SqlConnection = New SqlConnection("server=shailu;uid=sa;pwd=;database=pubs")
Dim sadapt As SqlDataAdapter = New SqlDataAdapter("select * from account where accountcode like '%" & DataGrid1.Item(DataGrid1.CurrentRowIndex, 0) & "%'", con)
Dim ds As DataSet = New DataSet
sadapt.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub

Best Regards,
shailu
Reply With Quote  
Join Date: Nov 2007
Posts: 14
Reputation: saravanarajan is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
saravanarajan saravanarajan is offline Offline
Newbie Poster

Re: Plz Help me hurry!

  #3  
Nov 10th, 2007
thank you very much for your help

regds,
saravnarajan
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 5:05 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC