110 pts.
 INTERUPTION IN VB EXPRESS2008
I am working in a program in vb 2008 express edition When trying to insert codes to an event the whole system just dissapear. I mean the whole program just dissapear without any notice.This happens all the time and I fiound it impossible to work with it..These codes are sql queries up to 12000 lines.Can anyone help

Software/Hardware used:
ASKED: July 19, 2009  7:59 PM
UPDATED: July 21, 2009  11:02 PM

Answer Wiki:
Sounds like it is crashing. Have you tried the SP1 version of VB 2008 express? http://www.microsoft.com/express/download/#webInstall --------- I would recommend to debug the program to determine exactly what line of code is causing the problem. Then, if it is an SQL query, try running the query from another application, or directly against the database to see what happens. When you have determined the 'problematic' query, post it in the discussion section, and tell us what database you are using, and we might be able to offer more help. I have seen similar problems when connecting to Oracle databases and executing queries involving synonyms whose underlying table has been dropped.
Last Wiki Answer Submitted:  July 20, 2009  2:36 pm  by  Notanic   25 pts.
All Answer Wiki Contributors:  Notanic   25 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I have tried to do the same in another application.As soon as i paste the query the whole programe just vanish and I cant do nothing.When I open the express again the pasted codes are not there.
I have tried in the internet to see the max number of lines a form can bear but couldnt find it out.
The query is more than 12000 lines. Can this cause the problem?

 110 pts.

 

You have an SQL query of 12,000 lines ?? That is really a huge query !!! :-)

I imagine how hard can be to maintain such code.

Are you sure you can’t split it into smaller parts ?
How about putting it in a stored procedure ? (what database are you using ?)

 63,535 pts.

 

Iam not so good in store procidire.I use sql 2008 express.The prblem is that the value of the queries chang every week :this 1/15 of the query

textbox1.text = textbox1.text & _
"cast(case when  Hb1 = " & TextBox29.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb2 = " & TextBox30.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb3 = " & TextBox31.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb4 = " & TextBox32.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb5 = " & TextBox33.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb6 = " & TextBox34.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb7 = " & TextBox35.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb1 = " & TextBox36.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb2 = " & TextBox37.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb3 = " & TextBox38.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb4 = " & TextBox39.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb5 = " & TextBox40.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb6 = " & TextBox41.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb7 = " & TextBox42.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb1 = " & TextBox43.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb2 = " & TextBox44.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb3 = " & TextBox45.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb4 = " & TextBox46.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb5 = " & TextBox47.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb6 = " & TextBox48.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb7 = " & TextBox49.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb1 = " & TextBox92.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb2 = " & TextBox93.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb3 = " & TextBox94.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb4 = " & TextBox95.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb5 = " & TextBox96.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb6 = " & TextBox97.Text & " then '1' else '0' end as int)+ " & vbCrLf & _ 
"cast(case when  Hb7 = " & TextBox98.Text & " then '1' else '0' end as int) not in(17)  " & vbCrLf & _ 

The textboxes are in the form.The data base is being update every week
The values of TextBox1.Text to TextBox105.Text changes every week.Is it possible for store procedure?

 110 pts.

 

Sure it is.
You can define the query in your stored procedure, and pass the values of your textboxes to the stored procedure as parameters.

There are a couple of things that caught my atention.

First, what is the reason why you need to return ’1′ or ’0′ from your ‘case’ structures and then cast it to ‘int’ instead of returning 1 or 0 as numbers directly ?

Second, it seems that you could construct that code with a loop, without the need to write all those lines.

Something like this:

For BoxNumber = 1 To 105
	hbNumber = BoxNumber mod 7
	if hbNumber = 0 then 
		hbNumber = 7 
	end if
	textbox1.text = textbox1.text & "case when Hb" & hbNumber & " = " Me.Controls("TextBox" & BoxNumber).Text & " then 1 else 0 end + " & vbCrLf
Next
 63,535 pts.