|
Ok, I got it to work. What I did was saved query result into a dataset and then using string functions to get my data out and then create a datatable and added each row with data from the dataset.
Dim accessConnection As OleDbConnection = New OleDbConnection("Provider=MSIDXS")
Dim accessCommand As New OleDbCommand(query, accessConnection)
Dim newjobsDataAdapter As New OleDbDataAdapter(accessCommand)
Dim myDataSet As New DataSet()
Dim newjobsDataTable As New DataTable("newjobs")
newjobsDataAdapter.Fill(myDataSet, "newjobs")
Dim dataTableRowCount As Integer = newjobsDataTable.Rows.Count
Dim myDataTable As DataTable = myDataSet.Tables(0)
Dim tempdata As String
Dim spc1 As Integer
Dim spc2 As Integer
Dim spc3 As Integer
Dim spc4 As Integer
myDataTable.Columns.Add(New DataColumn("ID", GetType(Integer)))
myDataTable.Columns.Add(New DataColumn("JobID", GetType(Integer)))
myDataTable.Columns.Add(New DataColumn("JobTitle", GetType(String)))
myDataTable.Columns.Add(New DataColumn("Keywords", GetType(String)))
myDataTable.Columns.Add(New DataColumn("Location", GetType(String)))
myDataTable.Columns.Add(New DataColumn("Rate", GetType(String)))
For i = 0 To myDataTable.Rows.Count - 1
myDataTable.Rows(i)("ID") = i + 1
tempdata = myDataTable.Rows(i)("characterization")
spc1 = InStr(myDataTable.Rows(i)("characterization"), ",")
spc2 = InStr(myDataTable.Rows(i)("characterization"), ". Category")
myDataTable.Rows(i)("JobID") = Convert.ToInt32(Mid(tempdata, 1, spc1 - 1))
myDataTable.Rows(i)("JobTitle") = LTrim(Mid(tempdata, spc1 + 2, spc2 - 8))
spc1 = InStr(myDataTable.Rows(i)("characterization"), "Description")
spc2 = InStr(spc1, myDataTable.Rows(i)("characterization"), "~.")
myDataTable.Rows(i)("Keywords") = LTrim(Mid(tempdata, spc1 + 13, spc2 - spc1 - 12))
spc1 = InStr(myDataTable.Rows(i)("characterization"), "State")
spc2 = InStr(spc1, myDataTable.Rows(i)("characterization"), ".")
spc3 = InStr(myDataTable.Rows(i)("characterization"), "City")
spc4 = InStr(spc3, myDataTable.Rows(i)("characterization"), ".")
myDataTable.Rows(i)("Location") = LTrim(Mid(tempdata, spc1 + 7, spc2 - spc1 - 7)) + ", " + LTrim(Mid(tempdata, spc3 + 6, spc4 - spc3 - 6))
spc1 = InStr(myDataTable.Rows(i)("characterization"), "Rate")
spc2 = InStr(spc1, myDataTable.Rows(i)("characterization"), ".")
myDataTable.Rows(i)("Rate") = LTrim(Mid(tempdata, spc1 + 6, spc2 - spc1 - 6))
Next
Dim myDataView As DataView = myDataTable.DefaultView
If myDataTable.Rows.Count > 0 Then
GridView1.DataSource = myDataView
GridView1.DataBind()
End If
Hope this helps other people.
|
|
|
|
|
am using visual studio 2005 and I am trying to create a popup calender so
when a user click on a image on the main form, a calender will then popup,
the user will select a date and the date will then be passed back to the main
form and populate a textbox. it works fine. but when i used master page for
all my pages and i put the textbox inside the content , the calender pops up
but when i select the date nothing happens .. the textbox was not populated
with the selected date from the calender and the window was not closed.
Here is my code
Default Page/Parent Window/
function GetDate(CtrlName)
{
ChildWindow = window.open('Calendar.aspx?FormName=' + document.forms[0].name + '&CtrlName=' + CtrlName, "PopUpCalendar", "width=270,height=300,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no");
}
<asp:textbox id="txtStartDate" runat="server">
Start Date
Code for the Calendar Page/Child Page/
<asp:content id="Content1" contentplaceholderid="ContentPlaceHolder1" runat="Server">
function ReturnDate()
{
window.opener.document.forms["<%= strFormName %>"].elements["<%=strCtrlName %>"].value = "<%= strSelectedDate %>";
window.close();
}
function Close()
{
window.close();
}
Public strFormName As String
Public strCtrlName As String
Public strSelectedDate As String
Sub Page_Load(Sender As Object, E As EventArgs)
If Not IsPostBack Then
myCalendar.SelectedDate = System.DateTime.Now()
End If
strSelectedDate = myCalendar.SelectedDate.ToString("dd/MM/yyyy")
strFormName = Request.QueryString("FormName")
strCtrlName = Request.QueryString("CtrlName")
End Sub
Sub myCalendar_SelectionChanged(sender As Object, e As EventArgs)
strSelectedDate = myCalendar.SelectedDate.ToString("dd/MM/yyyy")
End Sub
</script
<asp:Calendar id="myCalendar" runat="server" OnSelectionChanged="myCalendar_SelectionChanged">
</asp:Calendar>
<input id="btnReturnDate" onclick="Javascript:ReturnDate()" type="button" value="Select" runat="Server" />
<input id="btnCloseWindow" onclick="Javascript:Close()" type="button" value="Close" runat="Server" />
</asp:Content>
I need help
kidus
|
|
|
|
|
Hi,
I am also suffered with that problem. The problem is when you put the controls inside master page:
other container controls that
the runtime engine seems to change the names of the controls and adds
the '$' Character to them. You might want to view the rendered HTML
source sent to the browser.
And change your code according to those control name changes in masterpage.
Hope this helps.
|
|
|
|
|
I add to the name of the controls $ but there is no difference.Make it clear
pls help
kidus
|
|
|
|
|
And I put the controls inside the Asp:Content not Master page.
|
|
|
|
|
Hi,
In master page you can find the content place holder <asp:content ..="">
window.open('popup.aspx?textbox=ctl00_Body_Wizard1_txtBoxElectionDate1' here ctl00_Body_txtBoxElectionDate1 is the my text box name which i got be seeing the view source. use that name here.
And In popup.aspx I used like this:
String strScript = "window.opener.document.forms['aspnetForm']." + control.Value + ".value = '";
strScript += calDate.SelectedDate.ToString("MM/dd/yyyy");
strScript += "';self.close()";
strScript += "</" + "script>";
RegisterClientScriptBlock("anything", strScript);
aspnetForm is the the form name which contain the textbox to put the selected date.
Check your code.
Hope this helps.
|
|
|
|
|
hi
Thank you for your fast response
in the code
String strScript = "window.opener.document.forms['aspnetForm']." + control.Value + ".value = '";
the form name 'aspnetForm'.There is only one form in the master page.No other forms in the other pages.My text box is in the other pages.
Any help
kidus
|
|
|
|
|
you have to modifiy like this
onclick ="javascript:GetDate('ctl00$ContentPlaceHolder1$"Text box name here"')"
|
|
|
|
|
Hi All,
I am looking for very efficient solution for this problem. Here is my problem description - I have serveral database,
from which I have to pull data (All databases differ in physical design implementation), and insert them in standardized
common database. Let me give you an example
Database - 1
Table - 1
Col_1 - int
Col_2 - text
Col_3 - float
Database - 2
Table - 2
Col_1 - int
Col_2 - int
Col_3 - float
Col_4 - text
Col_5 - text
Common database
col_1 (id) - int
col_2 - int
col_3 - float
col_4 - text
So mapping between database - 1 and common database would be
col_1 --> col_2
col_2 --> col_4
col_3 --> col_3
and between database - 2 and commond database would be
col_1 --> col_2
col_2 --> col_2
col_3 --> col_3
col_4 --> col_4
col_5 --> col_4
How can I achive this? One more thing, this mapping can be changed during runtime.
Thanks,
AP
|
|
|
|
|
patelash01 wrote:
How can I achive this?
Just code the mappings you have supplied...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Hi
I have been playing around with a password hashing scheme for my application
But i keep getting an error message when it executes the command object
i get the error
Unable to cast object of type 'System.byte[]' to type 'system.inconvertible'
Any suggestions?
Sub CreateAccount(ByVal sender As Object, ByVal e As EventArgs)
Dim literror As New LiteralControl
'1. Create a connection
'Create connection string to pass database, string holds login information to mySQL,
Dim connectionString As String
connectionString = "Server=localhost; ;database=ftp1;"
'Builds .net mysql connection and passes connection string into method
Dim connection As New MySqlConnection(connectionString)
Try
'2. Create a command object for the query
Dim strSQL As String = _
"INSERT INTO Useraccount(Username,Password) " & _
"VALUES(?Username, ?Password)"
Dim objCmd As New MySqlCommand(strSQL, connection)
'3. Create parameters
Dim paramUsername As MySqlParameter
paramUsername = New MySqlParameter("?Username", SqlDbType.VarChar, 25)
paramUsername.Value = txtUsername.Text
objCmd.Parameters.Add(paramUsername)
'Encrypt the password
Dim md5Hasher As New MD5CryptoServiceProvider()
Dim hashedBytes As Byte()
Dim encoder As New UTF8Encoding()
hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(txtPwd.Text))
Dim paramPwd As MySqlParameter
paramPwd = New MySqlParameter("?Password", SqlDbType.Binary, 16)
paramPwd.Value = hashedBytes
objCmd.Parameters.Add(paramPwd)
'Insert the records into the database
connection.Open()
objCmd.ExecuteReader()
connection.Close()
Catch ex As Exception
literror.Text = ex.Message
MsgBox(ex.Message)
End Try
Response.Redirect("userhome.aspx")
End Sub
|
|
|
|
|
There is no cross-posting!
______________________
stuff + cats = awesome
|
|
|
|
|
So, instead of continuing the thread you started in the VB.NET forum, you decided to spam the ASP.NET forum with the same question? Do you really understand how forums work?
So, did you double check the items I brought up in my previous reply in the VB.NET forum, or did you just ignore them entirely?
|
|
|
|
|
I appologise all I will need to get of this hash and salt, apparently hash and pepper can be good?
Yes i did take account to what you said, and i believe SHA2 is a more secure encryption? and i have now ported my code to that.
Although I am still being hit with the same problem, I checked my field types and lengths and still no joy with that either
|
|
|
|
|
Try converting your byte() array to a Base64 string, then save that to the database.
|
|
|
|
|
The title of the post looks like you want to know about seasoning the drugs you obviously used when you decided to cross post. You've angered Leckey now - that's not a good thing.
|
|
|
|
|
______________________
stuff + cats = awesome
|
|
|
|
|
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
Dear sirs:
I have a simple ASP.NET WebForm; on it are: a combo-box (for months) and a submit button, an SqlDataSource (for chart data), a GridViewControl (interface between sql data source and chart control) and a chart control.
When I select a month from the combo box and hit a button, the proper data is displayed in the chart control. However, when I select another month from the combo box the same data is again displayed.
I made sure to wipe out the double-array that holds the data by instantiating a new instance of it in the constructor of the class in which it resides.
Here's what's interesting: if I click on the browser's "back" button and then the "forward" button; and then hit the "submit" button, the grid displays the proper data for the new month in the drop down combo box.
What is happening? What can I do to make sure the data from the sqldatasource/gridview is synched with the filter-select variable in the combo box?
Thanks in advance,
Rob Hyland
|
|
|
|
|
I think that i faced that kind of problems once.
It could be two reasons.
1. You put the databinding function in wrong place.
2. You may need to add some unique keys for getting the latest result. This is the reason probably for you. When I was using SQL Reporting Service in ASP.NET project, I faced the same problem that I was not able to get the latest data for my report even I passed the correct parameter.
Then, the solution was that I add the unique key (eg: timestamp) as paramenter to my report. Whenever I generate the report, i used to pass this timestamp value as a paramenter to report. Then, i got the latest result..
You may read for the problem and solution that I said above in this link. http://michaelsync.net/2007/05/13/tipstricks-aspnet-with-sql-reporting-services/
|
|
|
|
|
Michael:
Thanks for the quick response. If I understand you correctly, what you are implying that I should do is something like the following. Let's say that a portion of my SelectCommand of the SqlDataSource looks like so (this is Oracle P-SQL):
"..... where EXTRACT( MONTH from mh.historydatetime) = :MONTH_ID"
Now, the bind-variable comes from the SelectedIndex of the drop down combo box. What you are saying to do, in essence is something like the following:
"..... where EXTRACT( MONTH from mh.historydatetime) = :MONTH_ID AND :TIMESTAMP_INFO = :SUBMIT_TIME"
That sounds quite difficult. For one: how do I put the timestamp info into a variable? Secondly, what is the logic behind this? As long as a different month is selected from the drop down, it should use the new data, right?
Regards,
Rob
|
|
|
|
|
Hi Everybody
On my project I have a gridview with a button. When someone click the button then new page will be open with those parameter which is related on gridview
Thanks
Sarfarj Ahmed
|
|
|
|
|
Sarfaraj Ahmed wrote: : Open New window with some parameter
<br />
window.open ("http://www.javascript-coder.com?par1=1&par2=2",<br />
"mywindow","menubar=1,resizable=1,width=350,height=250");
|
|
|
|
|
I'm confused.
I'm new to ASP.NET, but already have enough experience with plain old HTML/classic ASP to get by (I'm more of a C/C++ guy trying to expand my horizons).
I have page that performs some database operations, with an asp:label that shows the result either in green or red text to indicate success or failure. I've defined two CSS classes:
.clsMessageSuccess<br />
{<br />
color: Green;<br />
}<br />
.clsMessageFailure<br />
{<br />
color: Red;<br />
}
Then at runtime, depending on the result of the database operation, I change my label's CssClass property to either clsMessageSuccess or clsMessageFailure. Works great.
Now I'm trying to revisit this and do things "the ASP.NET way" using themes and skins. I've defined the following in my .skin file:
<asp:Label runat="server" SkinID="sknResultLabelSuccess" ForeColor="Green" /><br />
<asp:Label runat="server" SkinID="sknResultLabelFailure" ForeColor="Red" />
I thought I'd simply be able to replace my label's SkinID property at runtime like I'm currently doing for CssClass. No such luck:
"The 'SkinId' property can only be set in or before the Page_PreInit event for static controls. For dynamic controls, set the property before adding it to the Controls collection."
Great. I could understand why, and it looks my approach is plain wrong, but what I don't understand then is how it should be done "properly". I could just forget about the whole skins idead and just change the label's ForeColor property instead of its SkinID (which apparently isn't allowed), but this goes against the very nature of code/styling separation. What if I also wanted to make the text bold? I'm not going to start changing multiple properties every place I'm currently trying to replace the SkinID.
Why not stick with replacing CssStyle? Because my master page uses one .css file, and it's getting quite long. It contains different sections that are only used by specific pages. I want to break that out into multiple .css files and *only* include the required files in the pages that need them. However, the master page is the one containing the head tag (and closes it), so I can't include additional .css files in other aspx files (or if I can, I haven't found out how). Traditionally, in classic ASP, I've been able to include multiple css files without any issue (eg, I have one basic css file that applies to all pages--which I've now put in the master page--and other files that apply only to the page in question). What's the proper way to do this in ASP.NET?
I'm starting to dislike the way ASP.NET does some things. Themes/skin files sound great in theory, but then looking at the HTML generated, I see it takes the attributes defined in skin files and applying them directly as style attributes to individual controls. Awesome. So CSS files made us take styling out of the HTML, but then skins adds them back?
-- modified at 10:24 Wednesday 11th July, 2007
|
|
|
|
|
|