|
with code.
See how much it sucks to get a vague, generic answer?
That's how it feels to see your vague, generic question.
|
|
|
|
|
If you know the answer just tell me. or else just leave it . I didn't beg u to answer my question. While writing code i had problem so only asked. Is there any rule that we should not ask simple questions?
|
|
|
|
|
He would if your question was answerable. Since you're leaving out critical details about what you are doing, it's impossible to answer your question.
|
|
|
|
|
Well.. funny you should ask, the rules[^], specifically number 2, actually kind of say yes, you should not ask vague, unanswerable questions.
|
|
|
|
|
No VB.Net code editors support super/subscript (or VB for that matter, but who cares about extinct languages).
SQL certainly does not support them either.
Maybe you could be more precise here. Are we talking about rendering to HTML? RTF? a Word Doc?
|
|
|
|
|
Hi everyone, I have a matrix and I need to add the money earned this year and past years. However, I must remove the money spent in past years. I must have the separate amount per year and the total of these amounts. This is what gives my matrix:
Year
= Fields!Year.value =formatnumber((sum (Fields!Results.Value)) - (sum (iif (Fields!
Year.value < Parameters!ChoosedYear.Value, fields!Moneyspent.value,
0))), 2) & "$"
However, the subtotal gives me an error. What should I do?
P.S.: I already found that the subtotal gives me an error because it's not in the scope of the rowgroup1, but is there a way to get the scope in the subtotal? or can anybody find another way to do it?
modified on Monday, March 22, 2010 3:33 PM
|
|
|
|
|
Hello to All,
Is it possible to hide Font Bold Propery from FontDialog.
Thanks
If you can think then I Can.
|
|
|
|
|
You can't
If you just want to offer the different fonts without styling and sizing etc. how about just showing a combo box with the list of installed fonts?
e.g.
Dim installedFonts as New System.Drawing.Text.InstalledFontCollection()
For Each family As System.Drawing.FontFamily In installedFonts.Families
me.comboBox1.Items.Add(family.Name)
Next
|
|
|
|
|
Thanks for reply.
I agree with your suggesion. But i want to do with fontdialog.
If you can think then I Can.
|
|
|
|
|
There are no options to turn off any of the controls in the dialog.
|
|
|
|
|
I am trying to insert data into SQL Server 2008 table using vb.net. When I try to insert the data I get the error "OleDbException was unhandled" Incorrect syntax near 'Name'. The code line MyCommand.ExecuteNonQuery is highlighted when the error is thrown. I can't find anything wrong. Can someone please help me out? Here is my code:
Dim myConnection As New OleDb.OleDbConnection<br />
myConnection.ConnectionString = "Provider=SQLNCLI10;Server=S10615-10\SQLEXPRESS;Database=Assessment; Trusted_Connection=yes;"<br />
<br />
Dim myCommand As OleDb.OleDbCommand<br />
Dim strOleDb As String<br />
<br />
myConnection.Open()<br />
<br />
strOleDb = "INSERT INTO AssessmentPage1 (Client Name, DOB, Medical Records #, Medicaid Number, Consumer's Name, Medicaid #, Consumer's ID, Clinicians, Parents/Guardians Name, Address, Clinicians(1), Phone Numbers, Date or Referral, Date of Assessment, School Name/Address/Phone #, Identifying Information, Presenting Problems, Referral Information) VALUES(" & TextBox1.Text & "," & TextBox2.Text & "," & TextBox3.Text & "," & TextBox4.Text & "," & TextBox5.Text & "," & TextBox6.Text & "," & TextBox7.Text & "," & TextBox8.Text & "," & TextBox9.Text & "," & TextBox10.Text & "," & TextBox11.Text & "," & TextBox12.Text & "," & TextBox13.Text & "," & TextBox14.Text & "," & TextBox15.Text & "," & TextBox16.Text & "," & TextBox17.Text & "," & TextBox18.Text & ")"<br />
<br />
<br />
myCommand = New OleDb.OleDbCommand(strOleDb, myConnection)<br />
myCommand.ExecuteNonQuery()<br />
<br />
'Close and clean up objects<br />
myConnection.Close()<br />
myCommand.Dispose()<br />
myConnection.Dispose()
|
|
|
|
|
That looks terrible. You should:
1.
show code in PRE tags (not in CODE tags); better formatting, better readability.
2.
give real names to all your variables and controls; a bunch of numbered textboxes is awful.
3.
not directly stuff user input into an SQL statement. Google "SQL injection" and start using parameterized SQL.
[ADDED]
4.
when you don't use parameterized SQL, then stuff string and datetime literals in appropriate delimiters.
[/ADDED]
Furthermore, I discourage the use of whitespace and special characters in database field names.
|
|
|
|
|
Looks like your field names contain spaces? e.g.
fresh1207 wrote: Client Name
I think you need to enclose these in square brackets to be handled correctly...
[Client Name]
I think it is better to use underscore instead of space or to use no space and use TheLikesOfThis
|
|
|
|
|
Thank you guys for the help. I got rid of the previous error but now I am getting the error "Invalid column name for all of my text fields. But when I enter numbers into all of the textboxes the data inserts into the database perfectly. Any ideas?
|
|
|
|
|
|
I don't think the ' is valid for example Consumer's Name is not a valid column name in your MySQL table
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Yes I have already removed the ' from the column names. I removed the spaces also. But I am still getting the error "Invalid column name". I only get the error for the fields I put letters in. I don't get the error for the numeric fields. Again, when I enter numbers in all of the fields, the insert works fine. The data type is set to VARCHAR for all of the columns so the field should accept letters also. I don't know wha the problem is. Here is my code as modified from the previous post:
Dim myConnection As New SqlClient.SqlConnection
myConnection.ConnectionString = "Data Source=S10615-10\SQLEXPRESS;InitialCatalog=Assessment;Integrated Security=SSPI;"
Dim myCommand As SqlClient.SqlCommand
Dim strSQL As String
myConnection.Open()
strSQL = "INSERT INTO AssessmentPage1 (ClientName, DOB, MedicalRecords, MedicaidNumber, ConsumersName, MedicaidNumber1, ConsumersID, Clinicians, ParentsName, Address, Clinicians1, PhoneNumbers, DateofReferral, DateofAssessment, SchoolName, IdentifyingInformation, PresentingProblems, ReferralInformation) VALUES(" & TextBox1.Text & "," & TextBox2.Text & "," & TextBox3.Text & "," & TextBox4.Text & "," & TextBox5.Text & "," & TextBox6.Text & "," & TextBox7.Text & "," & TextBox8.Text & "," & TextBox9.Text & "," & TextBox10.Text & "," & TextBox11.Text & "," & TextBox12.Text & "," & TextBox13.Text & "," & TextBox14.Text & "," & TextBox15.Text & "," & TextBox16.Text & "," & TextBox17.Text & "," & TextBox18.Text & ")"
myCommand = New SqlClient.SqlCommand(strSQL, myConnection)
myCommand.ExecuteNonQuery()
myConnection.Close()
myCommand.Dispose()
myConnection.Dispose()
|
|
|
|
|
Your insert statement is not correct. For example:
VALUES(" & TextBox1.Text & "," & TextBox2.Text & "...
If the value of TextBox1.Text is A and TextBox2.Text is B, this will give:
VALUES(A, B...
So, the SQL query goes looking for a column called A and a column called B, which don't exist so the query fails.
What you want is:
VALUES('A', 'B'...
Note the apostrophes.
As other people have pointed out, string concatenation is simple and easy but it is better to use parameterised queries for a number of reasons, one of which is that you don't have to worry about where to put the apostrophes.
|
|
|
|
|
Experts,
I have an application which takes up the whole screen (15 inches) is there any way that if i take the app on to say a smaller screen can i get the program to find out the size and basically zoom out so the application fits nicely onto the screen? (Ihaven't yet tested the app on another screen yet but am guessing that it won't fit)
Thus the same with a 17+ screen i would want the app to zoom in slightly.
Can this be done or is there any surgestions?
Many thanks
Dan
|
|
|
|
|
It is nothing to do with screen size in inches. It has all to do with the resolution e.g. 1024x768, 1280x1024, 2560x1600 etc.etc.
In vb.net, you can obtain the current screen resolution from the My.Computer.Screen , it has various things under this depending on what exactly you want to know about the display properties.
Also, if you using Anchoring and Docking of your controls in your form, when you resize the form, they will stay relative to each other in terms of size and positioning.
Dave
Don't forget to rate messages!Find Me On: Web| Facebook| Twitter| LinkedInWaving? dave.m.auld[at]googlewave.com
modified on Sunday, March 21, 2010 9:34 AM
|
|
|
|
|
Is there any way that i can get the current screen size and alter it automatically, e.g the screen size i am currently working on is 1280 by 800 pixels. If for example someone uses this program has a reolution of 1024 by 768 pixels can i alter the screen size for my program and whe they exit the program the pixels are returned to what they were at the start??
How would i go about doing this?
|
|
|
|
|
Try this...
Public Function ScreenResolution() As String
Dim iWidth as integer, iHeight as Integer
iWidth = Screen.Width \ Screen.TwipsPerPixelX
iHeight = Screen.Height \ Screen.TwipsPerPixelY
ScreenResolution = iWidth & " X " & iHeight
End Function
or
Public Function ScreenResolution() As String
Dim intX As Integer = Screen.PrimaryScreen.Bounds.Width
Dim intY As Integer = Screen.PrimaryScreen.Bounds.Height
Return intX & " X " & intY
End Function
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
Don't see why I deserved a 1 for that, it is just a way of determining the screen res.
Useful if you are trying to implement on different monitors.
Hey ho, can't please some people.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
I'm guessing it's because you didn't answer the question that he asked. He didn't ask how to determine the screen size, he asked how to set the screen size.
|
|
|
|
|
This is what happens when you try to help on a sunday afternoon with the footy on the telly.
Still, he shouldn't try to set the resolution.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|