|
Try
LIKE instead of IS. for eg DELETE from Table1 WHERE Name LIKE '%s'
Cheers!
<bold>Looney Tunezez
"If you build it....
.....BUGS will come!" -JB
Application.Run(new Form1(this.Dispose())); <--WHAT :wtf::confused::eek:
"Stability. What an interesting concept" - Chris Maunder
<bold>
|
|
|
|
|
thanks man it worked
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
Looney Tunezez wrote: Application.Run(new Form1(this.Dispose()));
*ROFL* Where do you get this code?
|
|
|
|
|
Hi Guys!!pls help,
I'm having a public holiday table storing all public holidays,so whenever is a holiday is then displayed on a portlet on my home page,so I want that portlet to also appear notifying if the next day is a holiday,
how can I do that??
|
|
|
|
|
you can use a query like this (SQL Server):
Select holidaydate from tablename
where datediff(day,getdate(),modifieddate) in (0,1)
|
|
|
|
|
I'm getting lost pls clarify a bit more,or is there any Jscript that I can use?pls help,my problem is that I really dont know how to do it for example when is friday and Monday is a holiday,the portlet has to appear on friday notifying that monday is a holiday....,and when is tuesday and wednesday is aholiday is has to appear on tuesday...
|
|
|
|
|
error
Line 10:
Line 11:
Line 12: val1 = BeginDate.SelectedDate
Line 13: val2 =EndDate.SelectedDate
Line 14:
val1 =BeginDate.SelectedDate
val2 =EndDate.SelectedDate
Sub Get_Click(Sender As Object, E As EventArgs)
'Dim MyConnection As SqlConnection
'Dim MyCommand As String
'Dim strin As String=tb.Text
'Dim strout As String=tb1.Text
Dim dbpath
dbpath=Server.MapPath("..\staff2\database\Hotelmgt.mdb")
Dim objConnection as OleDbConnection
objConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &dbpath)
objConnection.Open()
Dim objCommand as OleDbCommand
objCommand = New OleDbCommand("SELECT HOTEL.Htlname, RATE.Roomtype, RATE.Datein, RATE.Dateout, RATE.Mealplan,RATE.Rate, RATE.Extnt FROM HOTEL INNER JOIN RATE
ON HOTEL.Htlid = RATE.Htlid WHERE (((RATE.Datein) >= val1)) AND ((RATE.Dateout) <= val2 ));",objConnection)
' objCommand = New OleDbCommand("SELECT HOTEL.Htlname, RATE.Roomtype, RATE.Datein, RATE.Dateout, RATE.Mealplan,RATE.Rate, RATE.Extnt FROM HOTEL INNER JOIN
'RATE ON HOTEL.Htlid = RATE.Htlid WHERE RATE.Datein Between [3/2/2005] And [6/1/2006] ORDER BY RATE.Datein",objConnection)
' bjCommand = New OleDbCommand("SELECT * FROM RATE WHERE (((RATE.Datein)>=#1/1/2004#) AND ((RATE.Dateout)<=#10/01/2005#));",objConnection)
'objCommand.SelectCommand.CommandType = CommandType.objCommand
'objCommand.SelectCommand.Parameters.Add(New Parameter("@Beginning_Date", DbType.DateTime))
'objCommand.SelectCommand.Parameters("@Beginning_Date").Value = BeginDate.SelectedDate
'("@Beginning_Date").Value = BeginDate.SelectedDate
'objCommand.SelectCommand.Parameters.Add(New Parameter("@Ending_Date", DbType.DateTime))
'objCommand.SelectCommand.Parameters("@Ending_Date").Value = EndDate.SelectedDate
'("@Ending_Date").Value = EndDate.SelectedDate
Dim objDataReader as OleDbDataReader
objDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection)
MyDataGrid.DataSource = objDataReader
MyDataGrid.DataBind()
objDataReader.Close()
End Sub
Parameterized Stored Proc Select to a DataGrid Control
Start Date
<asp:calendar id="BeginDate"
="" borderwidth="2" bordercolor="lightblue" font-size="8pt" titlestyle-font-size="8pt" titlestyle-backcolor="#cceecc" dayheaderstyle-backcolor="#ddffdd" dayheaderstyle-font-size="10pt" weekenddaystyle-backcolor="#ffffcc" selecteddaystyle-backcolor="lightblue" runat="server">
| End Date
<asp:calendar id="EndDate"
="" borderwidth="2" bordercolor="lightblue" font-size="8pt" titlestyle-font-size="8pt" titlestyle-backcolor="#cceecc" dayheaderstyle-backcolor="#ddffdd" dayheaderstyle-font-size="10pt" weekenddaystyle-backcolor="#ffffcc"
="" selecteddaystyle-backcolor="lightblue" runat="server">
|
| <asp:datagrid id="MyDataGrid" runat="server"
="" width="500" backcolor="#ccccff" bordercolor="black" showfooter="false" cellpadding="3" cellspacing="0" font-name="Verdana" font-size="8pt" headerstyle-backcolor="#aaaadd" enableviewstate="false">
|
how to get the calander value and using in database
jebin
|
|
|
|
|
I need to build a search function for my site. So there is a single text box for the users to type in their search string. I have been asked that I need to break the user's search string into separate words. So if the user enters: "This is my search query", I need to break it into: "This" "is" "my" "search" "query" and then search for all these words.
- Can I break a string into separet words using SQL?
- How do I remove funny / dangerous characters from the search string?
- If I have to break the search string using a programming language, I would have to run the search query for each word. If I run the search query for each word, How do I combine the search result for the user. For instance, if I search for "my" and find some result, then search for "search" and find some results, how do I display a SINGLE search result to the user.
thanks
|
|
|
|
|
Hi,
I was wondering if there was a better way of reading, updating and writing back text contained in a row in a DataTable in memory.
I need to read the text in a DataRow, and replace one character with another. For example, replace periods with backslashes.
Currently my code does this.
<br />
....<br />
DataTable convertperiodtoslash = new DataTable();<br />
sqlDataAdapter.Fill(convertperiodtoslash);<br />
foreach(DataRow dr in convertperiodtoslash.Rows)<br />
{<br />
foreach(DataColumn col in convertperiodtoslash.Columns)<br />
{<br />
dr[col] = dr[col].ToString().Replace(".", "\\");<br />
}<br />
}
Everything works fine, except that when there are 50,000 rows it takes around 10 mins to process. For smaller number of rows, say around 2000 or so it only takes seconds. So I was wondering if there was a better way of doing this update.. better meaning faster/more efficient code.
I found that the part which slows down the whole process is the writing back into the DataTable. If I write the modified text back into a string array it takes only 5-10 seconds to process even 50,000 rows.
dr[col] = (modified text)
^
|----> bottleneck
Any suggestions/recommendations will be greatly appreciated !!
Thanks in advance!
C# Noob..
|
|
|
|
|
Have you tried an update query?
UPDATE tbl SET tbl.Col = "\\"
WHERE tbl.Col Like "%.%";
DEBUGGING : Removing the needles from the haystack.
-- modified at 4:57 Friday 21st October, 2005
|
|
|
|
|
Hi sfdougl ! thanks for responding.
Would, what you suggested work on a DataTable in memory? or how would you do that to a DataTable in memory I guess is my question. I do not want to modify the source (sql) table and be able to update this list and spit it out into an excel file or text file. I also need to display this table in a datagrid to determine extra processing.
Here is my goal..
1. Read sql table..
2. Example row (always a string) "one.two.three"
3. Pull this data from a sql table and store into a DataTable and display in a DataGrid.
4. Output row "one\two\three" by replacing '.' with '\'
5. Also, if need be modify it to "one.two.three.four" - has to be determined at runtime.
6. Output this to a text file. I cannot modify the source.
|
|
|
|
|
What database technology are you using?
Which technology are you using to access the database?
I know ADO (pre .NET). I might have an option for you but without knowing what you’re using kind of hard to know the answer.
It should be possible to pull the data you seek from the db save it to XML and then modify that to suit the users needs (without looping).
Or you could always create a temp table to modify and drop the table after the data has been modified.
(sorry its taken so long to get back to you, I dont use the computer on the weekends )
DEBUGGING : Removing the needles from the haystack.
-- modified at 4:15 Monday 24th October, 2005
|
|
|
|
|
I am using a SQL server backend, and connecting using the SQLClient dataadapter in .NET (Visual Studio .NET 2003). I don't mind creating a temp table to modify, but again I'm unsure of how to bulk modify an entire table without looping. In fact even now I am only using a temp table which i populate using my select query.
I did consider XML, but didn't get the chance to play with it as yet.
thanks again for responding !
|
|
|
|
|
See my other post about using the Replace command as part of the SQL query. That should do the trick.
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
blackhole077 wrote: 1. Read sql table..
2. Example row (always a string) "one.two.three"
3. Pull this data from a sql table and store into a DataTable and display in a DataGrid.
4. Output row "one\two\three" by replacing '.' with '\'
Simple solution, should work for most RDBMS engines (cant believe I forgot about this one).
If you don’t mind transforming the data when pulling it out of the db use the ‘Replace’ TSQL command. This will not change the underlining data, only its presentation.
SELECT Replace([txt],".","/") AS epr
FROM tbl;
You indicated the display will be determined at runtime. So just do a simple switch or if to determine which way to pull the data. Hows that sound?
Transact-SQL Reference Replace[^]
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Sorry, it took so long to reply. I will try this out! I also found out that there was more manipulation required with the string than I had anticipated and I'm going in another direction, probably with arraylists or arrays. Thanks for your help! I really appreciate it!
|
|
|
|
|
No problem, always glad to try and help...
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
I have an application with a strongly typed Dataset which I populate and then transform the rows in the DataTable into objects used in my application. The application then updates the objects and I call code to update the appropriate DataRows before submitting the updates to the table.
I originally wrote the method to update the DataRow to update each column in the row using the value in the object passed in. This however causes the RowState of the DataRow to change from Unchanged to Modified even if the value has not changed. Therefore I have logic to check the values in the DataRow with the value in the object and only update if there is a change, this logic incorporates checking for null values also.
Is there any method of getting the DataRow to do this automatically?
|
|
|
|
|
Hi every body,
I have two questions which I failed to know their answers:
1- What is the best to make an ADO.NET connection with a DB (in a form in VB.NET) with one table in or with many tables but have a relationship between them through SQL?Why?
2- What is the best technique used in Vb.net to make a form has a connected DB. Is it by writing the code by ourselves Or, by using the available ADO.NET data providers(OLEDB) in the Toolbox in VB.NET?Why?
With Thanks.
-- modified at 8:57 Thursday 20th October, 2005
|
|
|
|
|
Deema Jack wrote: 1- What is the best to make an ADO.NET connection with a DB (in a form in VB.NET) with one table in or with many tables but have a relationship between them through SQL?Why?
There are many different ways. All have their pros and cons depending on the situation and what you want to use it for. What do you want to do?
Deema Jack wrote: 2- What is the best technique used in Vb.net to make a form has a connected DB. Is it by writing the code by ourselves Or, by using the available ADO.NET data providers(OLEDB) in the Toolbox in VB.NET?Why?
The best "technique" is to use some sort of data abstraction model. Create a class (or set of classes) whose responsibility is to access the database and let your form get on with the job of dealing with the user interface. Let everything do its thing well, rather than create some sort of monster that cannot do anything well.
If you think this answer is not very good it is because I am attempting to provoke you into starting a discussion where you tell us more about what you are doing and then perhaps we can guide you towards the right way to do it.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
I think I may be missing something simple as I can't find a similiar problem on the internet, so any help would be greatly appreciated. I am trying to access an SQL Server database through sharepoint via a web part. However I have sql client permission errors.
An Error has occurred: Request for the permission of type System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
I have tried many different connection strings and authentication modes but always have the same error.
The connection string currently is:"Data Source=lons3003;Initial Catalog=FF;Integrated Security=SSPI;"
Thanks in advance
|
|
|
|
|
Integrated Security? This means you have to give the web service thread the proper rights to access the SQL server. I usually go with a SQL username/password scheme instead of giving IUSR_* anonomous accounts any real domain rights.
|
|
|
|
|
Thank you for responding but I still have the same problem using username and password.
server = Server;database=db;uid=sa;persist security info = true;
any other suggestions?
|
|
|
|
|
Your Connection string should look something like this:
"Server=Aron1; Database=pubs; User ID=bob; Password=asdasd; Trusted_Connection=False"
I hope you are not using 'sa' (with or without a password).
I would create a specfic user on the SQL server with the exact rights necessary to accomplish your goals. It doesn't make sense to expose your system to the Internet like that.
You will find a whole set of connection string patterns on: www.connectionstrings.com [^]
|
|
|
|
|
Cheers. But I get the same problem using the username and password string.
|
|
|
|