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
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?
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 ?)
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
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?
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