Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Fu
Starting Member
23 Posts |
Posted - 2005-11-13 : 08:21:54
|
I created the following form in order to select entries from a table using the selecteddate() method of the calendar property. but when choosing a date i am not getting any results.-------------------------------------------------here's the soource------------------------------------------------- Sub page_load(ByVal sender As Object, ByVal e As EventArgs) Dim ods As New DataSet Dim odap As New OleDbDataAdapter Dim ocon As New OleDbConnection("provider=sqloledb; datasource=dr; initial catalog=bm;user id=admin; password=123") Dim ocom As New OleDbCommand Dim oparam As New OleDbParameter Dim cusdate As Date If Not IsPostBack Then cusdate = cal.SelectedDate() ocon.Open() ocom.CommandText = "select CDCoverURL as ' ',CDtitle as 'CD Title',convert(varchar,cd.cddate,106) as 'Release Date',CDType as 'Section',Label.Label,Shelf.Shelf from cd,shelf,label where cd.shelfid=shelf.shelfid and cd.labelid=label.labelid and cd.cddate=? order by cd.CDDate,cd.cdtitle" ocom.Connection = ocon oparam = New OleDbParameter("cdate", OleDbType.Date) ocom.Parameters.Add(oparam) oparam.Value = cusdate odap.SelectCommand = ocom odap.Fill(ods, "custom") gv.DataSource = ods.Tables("custom") gv.DataBind() ocon.Close() End If End Sub</script>---------------------------------------------------------------------- |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-11-13 : 08:26:11
|
i suggest using SqlDAtaAdapter for accessing sql server. It was made spceficaly for that.shouldn this ...and cd.cddate=? order by...oparam = New OleDbParameter("cdate", OleDbType.Date)be...and cd.cddate=@cddate order by...oparam = New OleDbParameter("@cdate", OleDbType.Date)Go with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|
|