Log in

I forgot my password

Alumni of BSU INFORMATION TECHNOLOGY

BSU INFO-TECH

FB COMMENT

vb.net long sql command

View previous topic View next topic Go down

vb.net long sql command

Post by Generym on Wed 08 Sep 2010, 1:09 am

Help paano ba pabababain ang pagkahaba habang sql command sa vb.net para di mgscroll ng pagkahababa to the right
avatar
Generym
Admin
Admin

Male
Number of posts : 260
Reputation : 1
Registration date : 2008-11-12

View user profile http://bsu-infotech.forumotion.com

Back to top Go down

Re: vb.net long sql command

Post by Generym on Wed 08 Sep 2010, 1:12 am

ung parang sa C sana na pwedi mo isingit ang code na \n for new line,para bababa yung ibang codes.
avatar
Generym
Admin
Admin

Male
Number of posts : 260
Reputation : 1
Registration date : 2008-11-12

View user profile http://bsu-infotech.forumotion.com

Back to top Go down

Re: vb.net long sql command

Post by Lyt_Grey on Wed 08 Sep 2010, 1:18 am

do you mean sa output nga query or yung query mismo....

If the query itself,. I think sql commands ignores white spaces kaya just press enter

ex.

SELECT
userName, Password
FROM
tblAccounts
WHERE
userID = '143';

avatar
Lyt_Grey
Admin
Admin

Male
Number of posts : 308
Age : 30
Location : La Trinidad, Benguet
Job/hobbies : Ado ngem basit lang
Reputation : 0
Registration date : 2008-12-04

View user profile

Back to top Go down

Re: vb.net long sql command

Post by Generym on Wed 08 Sep 2010, 1:21 am

jay kastoy ngay nga code,dba no vb.net ket atidog dayta,ket kailangan nga ag scroll to the right no ada e edit or kitam jay code

cmd.CommandText = "SELECT sum_Abra.indicators AS INDICATORS (sum_Abra.february+sum_Apayao.february+sum_Baguio.february+sum_Benguet.february+sum_Ifugao.february+sum_Kalinga.february+sum_MP.february)AS Total,(sum_Abra.feb_female+sum_Apayao.feb_female+sum_Baguio.feb_female+sum_Benguet.feb_female+sum_Ifugao.feb_female+sum_Kalinga.feb_female+sum_MP.feb_female)AS Female,(sum_Abra.march+sum_Apayao.march+sum_Baguio.march+sum_Benguet.march+sum_Ifugao.march+sum_Kalinga.march+sum_MP.march)AS Total2,(sum_Abra.mar_female+sum_Apayao.mar_female+sum_Baguio.mar_female+sum_Benguet.mar_female+sum_Ifugao.mar_female+sum_Kalinga.mar_female+sum_MP.mar_female)AS Female2,((sum_Abra.march+sum_Apayao.march+sum_Baguio.march+sum_Benguet.march+sum_Ifugao.march+sum_Kalinga.february+sum_MP.march)+(sum_Abra.februa
avatar
Generym
Admin
Admin

Male
Number of posts : 260
Reputation : 1
Registration date : 2008-11-12

View user profile http://bsu-infotech.forumotion.com

Back to top Go down

Re: vb.net long sql command

Post by Lyt_Grey on Wed 08 Sep 2010, 1:27 am

Have you tried using stored procedures or views

ex.

create a view for that query and name it view_INDICATORS

then your query in VB will just be

SELECT * FROM view_INDICATORS;

ex.
in MySQL ah

CREATE VIEW view_INDICATOR AS
SELECT blah, blah, blah, blah
FROM
table_BLAH;


Contents of View comes from the table and will automatically update itself
when the table source will be updated

stored procedure,.. i forgot na eh,.

hintayin natin post ni Raizel
avatar
Lyt_Grey
Admin
Admin

Male
Number of posts : 308
Age : 30
Location : La Trinidad, Benguet
Job/hobbies : Ado ngem basit lang
Reputation : 0
Registration date : 2008-12-04

View user profile

Back to top Go down

Re: vb.net long sql command

Post by Lyt_Grey on Wed 08 Sep 2010, 1:30 am

Eto, funny string concatenation in VB 2005


Dim query As String

query = "SELECT "
query = query & "userName, Password "
query = query & "FROM "
query = query & "tbl_UserAccounts "
query = query & "WHERE "
query = query & "userID = '143' "

cmd.CommandText = query;
avatar
Lyt_Grey
Admin
Admin

Male
Number of posts : 308
Age : 30
Location : La Trinidad, Benguet
Job/hobbies : Ado ngem basit lang
Reputation : 0
Registration date : 2008-12-04

View user profile

Back to top Go down

Re: vb.net long sql command

Post by Lyt_Grey on Wed 08 Sep 2010, 1:31 am

Pwede rin ciguro to

Dim query As String

query = "SELECT "
query &= "userName, Password "
query &= "FROM "
query &= "tbl_UserAccounts "
query &= "WHERE "
query &= "userID = '143' "


cmd.CommandText = query;
avatar
Lyt_Grey
Admin
Admin

Male
Number of posts : 308
Age : 30
Location : La Trinidad, Benguet
Job/hobbies : Ado ngem basit lang
Reputation : 0
Registration date : 2008-12-04

View user profile

Back to top Go down

Re: vb.net long sql command

Post by mye on Wed 08 Sep 2010, 1:52 am

pg 2008 pla pwd khit ung _ lang..
pero sa 2005 klangan & _

mye
Staff Sergeant
Staff Sergeant

Female
Number of posts : 113
Age : 30
Location : La Trinidad
Job/hobbies : Computer Instructor
Reputation : 0
Registration date : 2008-11-27

View user profile

Back to top Go down

Re: vb.net long sql command

Post by Lyt_Grey on Wed 08 Sep 2010, 2:12 am

mye wrote:pg 2008 pla pwd khit ung _ lang..
pero sa 2005 klangan & _

yun pala eh...

so instead na ganito

query = "select "
query &= "from "

eh ganito nalang

query = "select " & _
"from "
avatar
Lyt_Grey
Admin
Admin

Male
Number of posts : 308
Age : 30
Location : La Trinidad, Benguet
Job/hobbies : Ado ngem basit lang
Reputation : 0
Registration date : 2008-12-04

View user profile

Back to top Go down

Re: vb.net long sql command

Post by Lyt_Grey on Wed 08 Sep 2010, 2:16 am

Pero I still recommend views and stored proc for that kind of query...

Easier to modify your program for flexibility...

avatar
Lyt_Grey
Admin
Admin

Male
Number of posts : 308
Age : 30
Location : La Trinidad, Benguet
Job/hobbies : Ado ngem basit lang
Reputation : 0
Registration date : 2008-12-04

View user profile

Back to top Go down

Re: vb.net long sql command

Post by mye on Wed 08 Sep 2010, 3:37 am

oo nga eh.. tnx po :-)

mye
Staff Sergeant
Staff Sergeant

Female
Number of posts : 113
Age : 30
Location : La Trinidad
Job/hobbies : Computer Instructor
Reputation : 0
Registration date : 2008-11-27

View user profile

Back to top Go down

Re: vb.net long sql command

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum