|
That code from above takes the dates from 2 calenders on my .aspx page and requests that data from my SQL database within the constrains of those two dates.
That is how I have been doing it. I have those two dates setting the parameters of what my request needs to comply with. It then simply displays the data that is requested for that specific time period
|
|
|
|
|
span98 wrote: That code from above takes the dates from 2 calenders on my .aspx page
No, it doesn't. The code you've given already is SQL only. It takes nothing from any calendars. It may have received information that ultimately came from calendars, but not there.
I need to see .NET code. Describing it to me is not sufficient.
|
|
|
|
|
I'm not sure which code you are looking for.
I have bound my calender control to the terms @start and @end? That is the only code I can think of. The rest of my code is SQL. I've bound all my objects to DataSources on my .aspx and display them in dataViews etc. So I don't know where else I would have code as it does it all for you implicitly...
|
|
|
|
|
Don't know if it applies in SQL 2008, but in 2005 and earlier I always use this before my queries:
SET DateFormat dmy
as this tells SQL Server what format to expect dates in.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I'm a newbie to DB2 DBMS, so I wanna a front end client like mysqladmin to speed my process. Is there any?
Any advice would appreciate!
|
|
|
|
|
|
I don't use DB2, but I have used a package called TOAD for both SQL Server and Oracle - it is very useable, and there is a DB2 version.
The DB2 version is here (Freeware): http://www.toadsoft.com/toaddb2/index.html[^]
====================================
Transvestites - Roberts in Disguise!
====================================
|
|
|
|
|
pls i have a database with following structure
distributorID name mgrID date
where date is the day the person is register. the distributor is self jion on mgr
i need a query to be able per month get how many distributor are register under a given manager for the month.
the algorithm is like
if managerA register 2 people say B, C his level 1 increase by 2
if B register 3 people B say D,F, Glevel 1 increase by 3 and A level 2 increase by 3
if G register 1 person G level 1 increase by 1 and B level 2 increase by 1 and A level 3 increase by 1
any idea pls
|
|
|
|
|
Can you figure here how is your real data in table and figure result which you want to get from T-SQL statement.
Regards.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
I just installed SQL Server from the install disk that came with VS2008 Professional Edition (Academic).
I can't seem to find SSMS in Program Files.
I seem to remember from a previous installation in the past that SSMS is hard to find sometimes.
Am I just not looking for SSMS in the right place or does SSMS not come with the VS2008 Professional Edition (Academic)? The install CD tells me that SSMS is already installed on my computer....
|
|
|
|
|
Go to the MSDN or Technet SQL site and follow the links for the Express edition.
“If we are all in agreement on the decision - then I propose we postpone further discussion of this matter until our next meeting to give ourselves time to develop disagreement and perhaps gain some understanding of what the decision is all about.”-Alfred P. Sloan
|
|
|
|
|
Usually found in
install folder\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe
|
|
|
|
|
Hello,
I'm trying to set up PostgreSQL v8.3.3 as a bootstrap package with my VS2005 Setup project. Does anyone know of a url I can directly download the postgresql-8.3-int.msi file from? Everywhere I've found an installer, it's packaged in a zip file. I'd like to set my installer to download any prerequisites from the web as needed, rather than package the files directly with my installer. The size of the installer is an issue here (needs to be under 10 MB for emailing purposes).
Thanks,
Dybs
|
|
|
|
|
Hi.
I have developed a database application (Access database) in C#2005. I tested the application on XP and Vista. It worked fined until I tested it on a machine that has windows Vista ultimate (64-bit) and have .net framework 3.5, I got the following error:
************** Exception Text **************
System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.4.0'
provider is not registered on the local machine.
How can I fix this problem?
Mohammed Emam
.NET Developer
|
|
|
|
|
Make sure you have MS Access installed or at minimum your have the runtime installed. AccessDBs are file based instead of sever based which can lead to your problem.
“If we are all in agreement on the decision - then I propose we postpone further discussion of this matter until our next meeting to give ourselves time to develop disagreement and perhaps gain some understanding of what the decision is all about.”-Alfred P. Sloan
|
|
|
|
|
hello
i am new in sql and i have create one small application with one table which has six columns
i want to check recores from sql database but it always shows nothing this is the code bellow in load event, all i want to do is if there is no data in sql database then it should shows "Empty Database" in Combo box
but it's not working
Private Sub LoadCboItems()
dcIMS = GetDBConnection()
cboDisp.Items.Clear()
If Me.BindingContext(dsIMS, "IMS").Count = 0 Then :confused:
cboDisp.Text = "Empty Database"
Exit Sub
Else
Dim MyReader As SqlDataReader = Nothing
Try
Dim MyData As New SqlCommand("SELECT * FROM IMS", dcIMS)
MyReader = MyData.ExecuteReader
Do While MyReader.Read
If rdoID.Checked Then
cboDisp.Items.Add(MyReader.Item("InkNumber").ToString)
cboDisp.SelectedIndex = 0
ElseIf rdoName.Checked Then
cboDisp.Items.Add(MyReader.Item("InkName").ToString)
cboDisp.SelectedIndex = 0
End If
Loop
Catch ex As Exception
MsgBox(ex.Message)
Finally
MyReader.Close()
dcIMS.Close()
dcIMS.Dispose()
End Try
End If
End Sub
|
|
|
|
|
bapu2889 wrote: dcIMS = GetDBConnection()
cboDisp.Items.Clear()
I hate binding questions, what is dcIMS declared as?
You are testing the count of the binding context, presumably tied to the form (me), is this what you want to test.
I use datatables and have no problem with the counting of rows nor binding to a combo box. Did i mention I hate binding widgets!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
dcIMS is sql data connection
cboDisp is combobox
and what i want to do is when i start application so first it checks if there is any data in data base is it's there then it's shows the list of inks but if it's empty then i want to display "Empty Database" in combo box
thanks for your rep.
have a nice day
|
|
|
|
|
And your code work properly or not? If no do you have any error message or where is problem with code?
Try to bind cboDisp with values from database then check items on cboDisp,if ItemCount of combobox is 0 then add string "Empty Database" otherwise add list of links.
Hope this will help you.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
Wel, given that by line 3 all you have done is establish a database connection, what can you epect your If... statement to return?
Try something more along these lines
Dim MyData As New SqlCommand("SELECT * FROM IMS", dcIMS
MyReader = MyData.ExecuteReader
If MyReader.HasRows Then
Do While MyReader.Read
' ...whatever
Loop
Else
cboDisp.Text = "Empty Database"
End If
MyReader.Close()
dcIMS.Close()
As an aside, you should not, as a rule, leave Closing your database connection to the Finally clause of a Try block - what happens if an error occurs outside that? Instead, open your Db connections at the last moment possible, and close them immediately after, and test for an open connection in Catch part - eg:
Dim dbConn As New SqlConnection
...
Try
..some code
dbConn.Open
.. data amnipulation
dbConn.Close
..more code
Catch
If dbConn.State = ConnectionState.Open Then dbConn.Close()
...
End Try
...
|
|
|
|
|
Hi Phil
first of all thank you very much for your mail and rep.
yes it works fine and now it's shows "empty database" if database is empty else it shows inkID so great
i didn't know about the has rows but now i learn
thanks again
have a nice day
|
|
|
|
|
hello,
this is a sql statement that i m trying to use in a Window application in .NET.
query:
<pre>string selCmd = "SELECT eInfo.EmpID, eInfo.Name, lInfo.LeaveEnteredOn, lInfo.LeaveFrom, lInfo.LeaveTo, lInfo.LeaveType" +
"FROM lmsEmpInfo AS eInfo INNER JOIN lmsLeaveInfo AS lInfo ON lInfo.EmpID = eInfo.EmpID" +
"WHERE (lInfo.LeaveGranted = 0)";</pre>
the problem is this query works fine when i m running it on the SQL server management studio, but gives an error of "Incorrect syntax near AS", when i try to execute it with the following code:
<code>
SqlDataAdapter myAd = new SqlDataAdapter();
SqlConnection myCon = new SqlConnection();
DataSet myDs = new DataSet();
myCon.ConnectionString = Properties.Settings.Default.LeaveMgmtConnectionString.ToString();
myAd.SelectCommand = new SqlCommand(selCmd, myCon);
myAd.Fill(myDs, "Recent_Leaves");</code>
Please help me to rectify this mistake......... I would also like to have suggestions on
How can i change the entire row collection of a DataGridView with the SelectedIndexChange event of a combobox and that too according to query that is being fired at the same event
any help or assistance is greatly appreciated!!
regards
|
|
|
|
|
Sujay chakraborty wrote: string selCmd = "SELECT eInfo.EmpID, eInfo.Name, lInfo.LeaveEnteredOn, lInfo.LeaveFrom, lInfo.LeaveTo, lInfo.LeaveType" +
"FROM lmsEmpInfo AS eInfo INNER JOIN lmsLeaveInfo AS lInfo ON lInfo.EmpID = eInfo.EmpID" +
"WHERE (lInfo.LeaveGranted = 0)";
First of all there should be some space in the string where u concat the 3 strings...
and for ur other query pls clear ur question a bit more...
When you fail to plan, you are planning to fail.
|
|
|
|
|
well first of all thanx for helping me out with such silly mistakes. I really appreciate that.
well as far as my second doubt is concerned, what i m trying to do is to fetch records from the database to a DataGridView according to the query passed(i.e. a select command which will fill up the table in the dataset), what i m doing is m not externally attaching this DataGridView with the concerned table (from the properties of the datagridview), rather after filling up the dataset and the table m doing this in the SelectedIndexChanged event of the ComboBox:
DataGridView1.DataSource = null;
DataGridView1.DataMember = null;
DataGridView1.Refresh();
myAD.Fill(ds,"tbl1"); //myAD is DataAdapter and ds is the DataSet
DataGridView1.DataSource = ds;
DataGridView1.DataMember = "tbl1";
DataGridView1.Refresh();
well this code works fine for the first time and fetches me the exact result, but when i change the item in the combobox it still keeps the previous previous recods and adds the new ones below. I want the previous records to disappear.I tried the method DataGridView1.Rows.Clear() but its giving me error.
Please do explain me what is actually happening wrong because m new to this technology, your help is greatly awaited!!!
Regards
Sujay
|
|
|
|
|
Your code is subject to sql injection attacks with the string concatenation. Look up Colin Mackay's article on this site about preventing such attacks.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|