rubin2001

combobox selected value : FIRMALAR

 FIRMALARKODU  automatik add " FIRMALARKODU ".FIS_BASLIGI FB


example 1:  D00001.HESAP_PLANI ,D00001.FIS_BASLIGI

example 2: D00005.HESAP_PLANI,D00005.FIS_BASLIGI


vs..

 

System.Data.SqlClient

Public Class Form1

Dim cn As New SqlConnection("Server=.;Database=prest;User ID=sa;Password=;Trusted_Connection=False;")

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim da As New SqlDataAdapter("select * from D00000.FIRMALAR", cn)

Dim ds As New DataSet

da.Fill(ds, "D00000.FIRMALAR")

ComboBox1.DataSource = ds.Tables("D00000.FIRMALAR")

ComboBox1.ValueMember = "FIRMA_ID"

ComboBox1.DisplayMember = "KISA_ADI"

DataGridView1.Visible = False

 

End Sub

Private Sub ComboBox1_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectionChangeCommitted

Dim da As New SqlDataAdapter("select a.HESAP_KODU MUSTERI_KODU,a.HESAP_ADI1 MUSTERI_ADI,E.METIN1 ADRES,E.METIN2 TELEFON,E.METIN5 FAX,E.METIN3 E_MAIL,E.METIN4 SEHIR,case when (a.ALT_HESAP_SAYISI=0)and (sum(isnull(b.ALACAK_TUTARI,0))>sum(isnull(b.BORC_TUTARI,0))) then sum(isnull(b.ALACAK_TUTARI,0))-sum(isnull(b.BORC_TUTARI,0)) when (a.ALT_HESAP_SAYISI=0) AND (sum(isnull(b.BORC_TUTARI,0))>sum(isnull(b.ALACAK_TUTARI,0))) THEN sum(isnull(b.BORC_TUTARI,0))-sum(isnull(b.ALACAK_TUTARI,0)) else 0 end BAKIYE,case when (a.ALT_HESAP_SAYISI=0)and (sum(isnull(b.BORC_TUTARI,0))>sum(isnull(b.ALACAK_TUTARI,0))) then 'B'when (a.ALT_HESAP_SAYISI=0) and (sum(isnull(b.BORC_TUTARI,0))<sum(isnull(b.ALACAK_TUTARI,0))) THEN 'A' else '' end BK from  FIRMALARKODU .FIS_SATIRLARI b,   FIRMALARKODU .FIS_BASLIGI FB,  FIRMALARKODU .HESAP_PLANI a,  FIRMALARKODU .HESAP_INDEX c FIRMALARKODU.EK_ALANLAR E where b.HESAP_ID=c.CHILD_ID and c.PARENT_ID = a.HESAP_ID AND FB.FIS_ID=B.FIS_ID AND E.TABLO_ID=A.HESAP_ID AND E.TABLO_ADI='HESAP_PLANI' group by a.HESAP_KODU,a.HESAP_ADI1,a.ALT_HESAP_SAYISI,a.UST_HESAP_ID,E.METIN1,E.METIN2,E.METIN3,E.METIN4,E.METIN5 order by a.HESAP_KODU", cn)

da.SelectCommand.Parameters.Add("FIRMA_ID", SqlDbType.Int).Value = ComboBox1.SelectedValue

Dim dt As New DataTable

DataGridView1.Visible = True

da.Fill(dt)

DataGridView1.DataSource = dt

End Sub



Re: Visual Basic General combobox.selectedvalue

Geert Verhoeven

And what is the question

Geert

Geert Verhoeven
Consultant @ Ausy Belgium

My Personal Blog






Re: Visual Basic General combobox.selectedvalue

Spidermans_DarkSide

 

Hi,

I dont know the question but i guess you may need quote marks in your FROM statement i.e.>>

from

'FIRMALARKODU .FIS_SATIRLARI b',   'FIRMALARKODU .FIS_BASLIGI FB',  'FIRMALARKODU .HESAP_PLANI a',  'FIRMALARKODU .HESAP_INDEX c' ,  'FIRMALARKODU.EK_ALANLAR E' where b.HESAP_ID=c.CHILD_ID and c.PARENT_ID = a.HESAP_ID AND FB.FIS_ID=B.FIS_ID AND E.TABLO_ID=A.HESAP_ID AND E.TABLO_ADI='HESAP_PLANI' group by a.HESAP_KODU,a.HESAP_ADI1,a.ALT_HESAP_SAYISI,a.UST_HESAP_ID,E.METIN1,E.METIN2,E.METIN3,E.METIN4,E.METIN5 order by a.HESAP_KODU", cn)

as you have spaces in those strings.

Hope that solves it !     

 

Regards,

S_DS

 






Re: Visual Basic General combobox.selectedvalue

rubin2001

combobox selected adding select * from FIRMAlarKODU.HESAPPLANI

db tables :

FIRMA_ID

FIRMAADI

FIRMALARKODU