|
First, using string concatentation to build a query is just plain bad practice. Especially when you are doing with with consecutive, individual characters. It makes your code impossible to read and debug accurately.
Oh, and your call to Replace is not needed at all. Using the @ character in a string to denote new lines in an SQL statement is a bad idea since SQL parameters usually start with that character.
A better method is to use String.Format:
string queryString;
queryString = String.Format("CREATE FUNCTION '{0}'.'{1}'()\nRETURNS INT\nBEGIN\nEND;", node, functionName);
Now is your code easier to read, or is mine?
|
|
|
|
|
Yes you are right...Thanks man....If you could provide the solution for the problem which i posted some min ago....
|
|
|
|
|
Every one voted it down how can i remove it?
Ques was:- I am Trying to built the search box for my windows app that searches the data from the database
Thanks
modified 15-Apr-12 9:27am.
|
|
|
|
|
You need to give some more detail about what this box will do and what part you are having trouble with. Putting your question into Google will give you some useful suggestions.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
|
onurag19 wrote: I want to develop a search box for my windows form application please help..
You might want to elaborate a bit on your question. What's going to be searched? A database, the internet, the local filesystem?
If you're targetting a database, read up on the LIKE function.
Bastard Programmer from Hell
|
|
|
|
|
Thanks that wat i was looking for thanks a lot
|
|
|
|
|
Please don't remove original content, it ruins the whole thread as what remains is unintelligible.
|
|
|
|
|
onurag19 wrote: Ques was:- I am Trying to built the search box for my windows app that searches the data from the database
This is no more descriptive than your original question. Try asking a question with some specific detail; you have still not explained which part of this project is causing you difficulty.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
I am Trying to built the search box for my windows app that searches the data from the database like if admins types the keyword student the name of all the students should be shown. I have used the LIKE operator for it but its not working accurately.
|
|
|
|
|
onurag19 wrote: but its not working accurately.
I don't think anyone can guess why from that little information. Try and explain clearly what you are doing, what results you expect, and what results you see. If some of your code is failing then show that code (not all, just the failing portion), and be sure to check and explain the values of any variables used.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
Thanks for you Interest Sir.
|
|
|
|
|
Hello,
I'm using a Datagridview in Windows application. Its working fine in my local machine, but when i tried to execute in my server( Winodws 2008 SP2), few columns not updating with the value using the below statement.
DataGridView1.Rows(e.RowIndex).Cells("ApprovedBy").Value = "UserName"
DataGridView1.Rows(e.RowIndex).Cells("ApprovedDateTime").Value = Now()
Can anyone suggest a solution for this.
Please!!.
Thanks
|
|
|
|
|
What do you return from Now() ? Is it a DateTime ?
|
|
|
|
|
Yes Pete. Its a DateTime column.
|
|
|
|
|
Could you show us the code in Now()? I suspect that this is where your problem is lying - the server using a different date format to your local version.
Of course, you could whack some exception handling and logging into your DAL and see what the server is rejecting.
|
|
|
|
|
DataGridView1.Item("ApprovedDateTime", e.RowIndex).Value = Now()
DataGridView1.Item("ApprovedBy", e.RowIndex).Value = Username
But the same code works fine for below columns
DataGridView1.Rows(e.RowIndex).Cells("LastModifiedBy").Value = Username
DataGridView1.Rows(e.RowIndex).Cells("LastModifiedDateTime").Value = Now()
I tried to mimic the Null reference error, by replacing the first two lines with the below lines
DataGridView1.Item("ApprovedDateTime", e.RowIndex).Value = now() DataGridView1.Item("ApprovedBy", e.RowIndex).Value = username
even now also, i'm experiencing same issue and Application got crashed.
|
|
|
|
|
What are the column definitions for those fields (both the Approved... and the LastModified... fields)? If you could show us your table definitions then we could have a look.
|
|
|
|
|
Hello Pete,
Pls find the details below.
ColumnName DataType Length Nullable
--------------------------------------------------------
ApprovedFlag int 4 no
ApprovedDateTime datetime 8 yes
ApprovedBy varchar 30 yes
LastModifiedBy varchar 30 yes
LastModifiedDateTime datetime 8 yes
|
|
|
|
|
Hmmm. Sorry, I can't see what's happening. What you could do, is attach the query explorer to the SQL Server instance, and see what SQL it's receiving. That would be what I would do.
|
|
|
|
|
Could you please let me know the steps to do this?
|
|
|
|
|
You can find out how to do this here[^].
|
|
|
|
|
Hello Pete,
I tried to debug the code in the server after installing Visual studio.
I'm getting the below error in Cell_formatting event in this line
dgEditor.Rows(e.RowIndex).Cells("Status").Value = "Used"
e.CellStyle.BackColor = Color.LightGreen
e.CellStyle.SelectionBackColor = Color.LightGreen
e.CellStyle.SelectionForeColor = Color.Black
ERROR:
An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll
{Unable to evaluate expression.}
I have made a check below, but it is partly working and not updating "Status" column and coloring,
If e.Value Is Nothing Then
Exit Sub
End If
Is there anyway i can mimic this issue?
Please help. I can also paste my Cell_formating code if you want to look at it.
|
|
|
|
|
Wait a second. You're changing the value of some text here in this event? I'm pretty sure that will trigger the event again - this would lead to a StackOverflowException .
|
|
|
|
|
Please let me know if there are any steps to overcome it.?
I will need to set the Color for "status" column.
|
|
|
|