I have a page like this

![enter image description here](https://i.stack.imgur.com/aFOP3.jpg)

In my `SQL`, I want calculate some value between these days

And this is my code;

```
strQuery = @"SELECT  B.HESAP_NO, A.TEKLIF_NO1 + '/' + A.TEKLIF_NO2 AS 'TEKLIF',
B.MUS_K_ISIM, CONVERT(VARCHAR(10),A.ISL_TAR,103) AS 'TARIH',
SUM(ISNULL(CAST(A.ODENEN_ANAPARA AS FLOAT),0)+ISNULL(CAST(A.FAIZ AS FLOAT),0)+
      ISNULL(CAST(A.BSMV AS FLOAT),0)+ISNULL(CAST(A.GECIKME_FAIZ AS FLOAT),0)+
      ISNULL(CAST(A.GECIKME_BSMV AS FLOAT),0)) AS 'YATAN', 
      (CASE WHEN B.DOVIZ_KOD = 21 THEN 'EUR' WHEN B.DOVIZ_KOD = 2 THEN 'USD' WHEN B.DOVIZ_KOD = 1 THEN 'TL' END) AS 'KUR',
      D.AVUKAT, 
     (CASE WHEN D.HESAP IN (SELECT T_HESAP_NO FROM TAKIP) THEN 
     (SELECT ICRA_TAR FROM TAKIP WHERE T_HESAP_NO = D.HESAP)
     ELSE ' ' END) AS 'ICRA TARİHİ', 
     (CASE WHEN D.HESAP IN (SELECT T_HESAP_NO FROM TAKIP) THEN 
     (SELECT HACIZ_TAR FROM TAKIP WHERE T_HESAP_NO = D.HESAP)
     ELSE '' END) AS 'HACİZ TARİHİ'
FROM YAZ..MARDATA.BIR_TAHSIL A, YAZ..MARDATA.S_TEKLIF B, AVUKAT D
WHERE A.TEKLIF_NO1 = B.TEKLIF_NO1
AND A.TEKLIF_NO2 = B.TEKLIF_NO2
AND B.HESAP_NO = D.HESAP
AND A.HESAP_NO = D.HESAP ";

    if (txtBoxText1 != "")
    {
        strQuery = strQuery + " AND A.ISL_TAR >= @S_TARIH_B";

      dt_stb = DateTime.Parse(txtBoxText1);
      myCommand.Parameters.AddWithValue("@S_TARIH_B", dt_stb);
    }

    if (txtBoxText2 != "")
    {
        strQuery = strQuery + " AND A.ISL_TAR <= @S_TARIH_S";
      dt_sts = DateTime.Parse(txtBoxText2);
      myCommand.Parameters.AddWithValue("@S_TARIH_S", dt_sts);
    }

    strQuery = strQuery + " GROUP BY B.HESAP_NO, A.TEKLIF_NO1 + '/' + A.TEKLIF_NO2,A.ISL_TAR,B.DOVIZ_KOD ,B.MUS_K_ISIM, D.AVUKAT, D.HESAP";

```

And this is my `Function`;

```
ALTER FUNCTION [dbo].[fngcodeme]
(
    @HESAP INT,@BAS DATE, @BIT DATE,@DOV INT
)
RETURNS FLOAT

AS
BEGIN

RETURN( 
    SELECT SUM(TUTAR)
    FROM YAZ..MARDATA.M_GHAREKET
    WHERE TEMEL_HESAP = @HESAP
    AND DOVIZ_KOD = @DOV
    AND REF_KOD = 'GC'
    AND BACAK_GRUP = 'PERT'
    AND ISL_KOD = 1
    AND ISL_TAR >= @BAS 
    AND ISL_TAR <= @BIT
)
END

```

What I want getting a value in this code with this function.

`@BAS` is Start Date, `@BIT` is End Date

How can I associate `@BAS with Textbox1` and `@BIT with Textbox2` ?