|
Dear Satips,
I am using Access Database connected my project. I can execute the Quey on the database.
Please tell me what can I do to solve the problem.
Regards and Thanks.
JosephWONG
|
|
|
|
|
Check your Connection String? Because that may also have problem?
Regards,
Satips.
|
|
|
|
|
Dear Satips,
I have checked the Connection String, it's correct!
Thanks & Regards
JosephWONG
|
|
|
|
|
Let paste the Code we will check it out.
Regards,
Satips.
|
|
|
|
|
Dear Satips,
The code is shown as follow, and the database is MS Access.
<% @ Page Language="VB" Debug="True" %>
<% @ Import Namespace="System.Data" %>
<% @ Import Namespace="System.Data.OleDb" %>
<HTML>
<BODY>
<Form Runat="Server">
<asp:DataGrid id="dgQuesManage" runat="Server" HeaderStyle-BackColor="#CCFF00"
CellPadding="2" CellSpacing="2" DataKeyField="no"
onEditCommand="Edit"
onUpdateCommand="Update"
onCancelCommand="Cancel"
AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="no" HeaderText="Question No" ReadOnly="True"/>
<asp:BoundColumn DataField="cid" HeaderText="Subject ID" ReadOnly="True"/>
<asp:BoundColumn DataField="stem" HeaderText="Question"/>
<asp:EditCommandColumn HeaderText="Edit" ItemStyle-Wrap="False"
EditText="Edit" UpdateText="Update" CancelText="Cancel"/>
</Columns>
</asp:DataGrid>
</Form>
</BODY>
</HTML>
<Script Language="VB" Runat="Server">
Sub Page_Load(Sender As Object, e As EventArgs)
If Not IsPostBack Then
open_db
End If
End Sub
Sub open_db()
Dim dbProvider As String="provider=Microsoft.Jet.OLEDB.4.0; data source=C:\Inetpub\wwwroot\Test\quiz2.mdb"
Dim con As New OleDbConnection(dbProvider )
Dim strSQL As String
Dim objDataAdapter As OleDbDataAdapter
Dim objDataSet As DataSet
con.Open()
strSQL = "Select * from itembank "
objDataAdapter = New OleDbDataAdapter(strSQL, con)
objDataSet = New DataSet()
objDataAdapter.Fill(objDataSet, "itembank")
dgQuesManage.DataSource=objDataSet.Tables("itembank").DefaultView
dgQuesManage.DataBind()
con.Close()
End Sub
Sub Edit(Sender As Object, e As DataGridCommandEventArgs)
dgQuesManage.EditItemIndex=e.Item.ItemIndex
open_db()
End Sub
Sub Update(Sender As Object, e As DataGridCommandEventArgs)
Dim dbProvider As String="provider=Microsoft.Jet.OLEDB.4.0; data source=C:\Inetpub\wwwroot\Test\quiz2.mdb"
Dim con As New OleDbConnection(dbProvider )
Dim strUpdateSQL, str1, no_str As String
con.Open()
Dim t1 As TextBox
t1=e.Item.Cells(2).Controls(0)
no_str=dgQuesManage.DataKeys(e.Item.ItemIndex)
str1="Set stem='" & t1.Text &"' Where no='" & no_str & "'"
strUpdateSQL="Update itembank " & str1
Dim objCommand As New OleDbCommand(strUpdateSQL, con)
objCommand.ExecuteNonQuery()
con.Close()
dgQuesManage.EditItemIndex=-1
open_db()
End Sub
Sub Cancel(Sender As Object, e As DataGridCommandEventArgs)
dgQuesManage.EditItemIndex=-1
open_db()
End Sub
</Script>
Thanks and regards.
JosephWONG
|
|
|
|
|
In the code there is no error it should work fine.
Regards,
Satips.
|
|
|
|
|
Dear Satips,
Before I post my code for you, I guess the code is correct! Actually I cannot store or update the data into the database. I don't know how to do????
Thanks for your assistance so much.
JosephWONG
|
|
|
|
|
Did you wrote the class for the Insert,Update, Edit and Delete and did you execute that class?
Regards,
Satips.
|
|
|
|
|
Dear Satips,
I have only wrote a class for Update, and have been tested by my friend, they replied that the class was fine and works.
Thanks a lot of assistance.
Regards
JosephWONG
Finally, I hope my message can assist or takle your problem.
God Bless You!
|
|
|
|
|
Dear Satips,
I have only wrote a class for Update, and have been tested by my friend, they replied that the class was fine and works.
Thanks a lot of assistance.
Regards
JosephWONG
Finally, I hope my message can assist or takle your problem.
God Bless You!
|
|
|
|
|
Hi All,
I am getting the following error when i am trying to execute my asp code:
aspSmartUpload error '800a0009'
Subscript out of range
/seba/marketing/updatejobs.asp, line 29
The code at Line 29 is:
mySmartUpload.Upload
Can anyone tell me what and where is the problem.
Thanks.
Anurag Gandhi.
|
|
|
|
|
This is the ASP.NET forum, try the web development forum for asp questions.
There's obviously no subscript there, looks like you're calling a component and it is what's blowing up.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i am having a gridview in which i have a dropdown which is populating from the database on gridviews row created event . i want to show the default first row as select in the dropdownlist .How to do this
i did
<asp:DropDownList ID="DropDowmFormGroup" Width="100px"
runat="server" OnSelectedIndexChanged="DropDowmFormGroup_SelectedIndexChanged"><asp:ListItem Text="Select One"></asp:ListItem>
protected void DropDowmFormGroup_SelectedIndexChanged(object sender, EventArgs e)
{
foreach (GridViewRow gvr in GrdFormType.Rows)
{
maintainance m = new maintainance();
DataSet dsFormTypeForDropDown = new DataSet();
dsFormTypeForDropDown = m.Get_Form_Group();
if(gvr.RowType ==DataControlRowType.Footer)
{
DropDownList ddl = (DropDownList)gvr.FindControl
("DropDowmFormGroup");
ddl.DataSource = dsFormTypeForDropDown;
ddl.DataTextField = "Group_Name";
ddl.DataValueField = "Form_Group_ID";
ddl.DataBind();
}
}
}
but my this event is not firing on dropdownlist .
please help me out.
thanx .
|
|
|
|
|
Hi,
You should set autopostback property of dropdownlist to true.
Then only the event will fire.
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
since i am using ajax --update panel my doing autopostback to true also donot go into the event .
|
|
|
|
|
Did you check it by putting the break points on the DropDownList and see what error it shows?
Regards,
Satips.
|
|
|
|
|
i am not getting any errors .
|
|
|
|
|
Did you get the values after executing the break point (or) it is null?
Regards,
Satips.
|
|
|
|
|
i solved it myself now
like this.
ListItem li = new ListItem("--Select--","0");
ddl.Items.Insert(0, li);
ddl.SelectedValue = "0";
//ddlCountry.Items.Add(lst);
for (int i = 0; i <= dsFormTypeForDropDown.Tables[0].Rows.Count-1; i++)
{
ListItem lst = new ListItem();
lst.Text = (string ) dsFormTypeForDropDown.Tables[0].Rows[i][1];
//lst.Value = (Int32 ) dsFormTypeForDropDown.Tables[0].Rows[i][0];
ddl.Items.Add(lst);
}
|
|
|
|
|
Fine.
Regards,
Satips.
|
|
|
|
|
|
Welcome
Regards,
Satips.
|
|
|
|
|
hii i m trying to retrieve data from sql using C#.net
private void Page_Load(object sender, System.EventArgs e)
SqlConnection con;
SqlDataReader dr;
SqlCommand cmd;
con = new SqlConnection("Server=ADNAN;Database=system;UID=sa;pwd=");
cmd = new SqlCommand("Select * from info",con);
con.Open();
dr= cmd.ExecuteReader();
Repeater1.DataSource= dr;
Repeater1.DataBind();
dr.Close();
con.Close();
Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection.
When user id and password is removed..recieves a message
"Login failed for user ' ADNAN \ASPNET"
Ahsan
|
|
|
|
|
go to the enterprise manager, and create a new user for the database SYSTEM.
it should be an asp.net user, also grant all the privileges..
hope it helps
Kunal
|
|
|
|
|
Hi All ,
A site which i have developed is working on both http and and using (SSL certificate)https. My problem is that i want the use https only when once the user logged in otherwise it works on the http.
Should i redirect to Page if the session object is not null then
redirect to https://abc.com/default.aspx else http://abc.com/default.aspx
or Is there another way in web.config or else to handle these protocols.
basically i don't want to hardcode the root path
Response.Redirect("https://abc.com/default.aspx")
OR Response.redirect("http://abc.com/default.aspx")
instead of
Response.Redirect("~/default.aspx");
Thanks in Advance....
Regards
Srnandan..
|
|
|
|