|
I have the following code but when I build this it gives me errors that username, userpass, userfname does not exist in current context.
I don't know where is the problem and how can I fix this.
SqlConnection objConn = new SqlConnection("Data Source=sql1300.mssqlservers.com;Initial Catalog=twcsan;Persist Security Info=True;User ID=twcsan;Password=mln0531");
SqlCommand objCmd = new SqlCommand("UPDATE tbUsers SET MyName = @username, " +
"MyPass = @userPass, " +
"UserFName = @userfname, " +
"WHERE UserId = 10", objConn);
objConn.Open();
objCmd.Parameters.AddWithValue(@username1, TextBox1.Text);
objCmd.Parameters.AddWithValue(@userPass, this.TextBox2.Text);
objCmd.Parameters.AddWithValue(@userfname, this.TextBox3.Text);
objCmd.ExecuteNonQuery();
objConn.Close();
Thanks in advance
hahii
|
|
|
|
|
Please try to write a relevant subject. "urgent please help" says nothing about your specific question, and does nothing to distinguish it from all the other questions.
You have forgotten the quotes around the strings.
objCmd.Parameters.AddWithValue("@username1", TextBox1.Text);
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi all,
I have a gridview that has an edit template with a textbox and a dropdown list in it.
At runtime the textbox and dropdown are invisible on the gridview (because they only show in edit view).
When I click "Edit", the textbox and dropdown appear.
I want to be able to reference the dropdown list but when I try to do so, I get the "Object reference not set to an instance of an object." error.
Here is my code:
protected void grdTrak_RowDataBound1(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
((DropDownList)e.Row.FindControl("dlStatus")).Attr ibutes.Add("onSelectedIndexChanged", "enableother(this)");
}
}
Does any one know what the problem could be?
Thank you in advance!
Dave
|
|
|
|
|
The row data bound happens for every row in the gridview. Only one row is set in edit mode, so you can not assume you will find the dropdown in each of the rows as they get data bound.
Hope that helps.
Ben
|
|
|
|
|
Hi guys,
I've been working on a pet project off and on now for a few months; trying to create my own personalized form of AI. Of course, I know a lot of people are against using ASP.NET for larger then standard web applications, but I figured it'd be easier to work with while I mess around.
I'm a fairly new programmer yet, so please bare with me.
The snags I have ran into I have managed for the most part on my own, with a few exceptions. I'm having some difficulty in isolating specific words and or phrases within sentences using regex.
I need to pull these words/phrases from a string and I haven't really managed to make it work quite right yet. I tried using various versions of "(/b)" & string & "(/b)" and I have tried a few others... nothing worked right, and I ended up having to gimp it using a statement to check if (/w) str OR str (/w) exists. That helped narrow things down by making sure i wasn't pulling words like can out of cannot etc but still has obvious issues.
Any suggestions on a regex pattern to isolate a full individual word out of a sentence?
If you're interested in seeing the AI in action, check out www.jeeney.com
Of course, if you have any suggestions in terms of coding or ideas on how to improove things in general, I'm totally open.
Thanks in advance!
|
|
|
|
|
hey guys i am very new to asp.net and i am building a website in which i want to access one "dll" file which contains two functions for image encryption and decryption.but i dn't know how to access those functions.
i want to make call like this
//
function getDecryptimage(strSourcepath:pchar): boolean; stdcall; external 'PSCrypto.dll'
function getEncryptimage(strSourcepath:pchar): boolean; stdcall; external 'PSCrypto.dll';
//
i dn't kow wat procedure to follow and which variables has to be declared for using this function.
is this call correct???
pls help me out guys .
|
|
|
|
|
|
I am having 3 pages in my application
from page1 by clicking button i am navigating to page3 while page_load of page3 i need to get the previos page URL that is here page1's URL.
can any body help in this secnario,
regards,
Subbu.
|
|
|
|
|
Get it from the Request.UrlReferrer property.
---
single minded; short sighted; long gone;
|
|
|
|
|
Ok, I switched my code as follows:
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
Public Sub Page_Load(Source As Object, E As EventArgs)
If Not Page.IsPostBack Then
BindData()
End If
End Sub
Public Sub DataGrid_Edit(ByVal Source As Object, _
ByVal E As DataGridCommandEventArgs)
myInfo.EditItemIndex = E.Item.ItemIndex
BindData()
End Sub
Public Sub DataGrid_Cancel(ByVal Source As Object, _
ByVal E As DataGridCommandEventArgs)
myInfo.EditItemIndex = -1
BindData()
End Sub
Public Sub DataGrid_Update(ByVal Source As Object, _
ByVal E As DataGridCommandEventArgs)
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim txtmyNewCol1 As TextBox = E.Item.Cells(1).Controls(0)
Dim txtmyNewCol2 As TextBox = E.Item.Cells(2).Controls(0)
Dim strUpdateStmt As String
strUpdateStmt = "UPDATE ToddsTable1 SET " & _
"myNewCol1 = '" & txtmyNewCol1.Text & "', " & _
"myNewcol2 = '" & txtmyNewCol2.Text & "' "
myConnection = New SqlConnection( _
"server=SQLSERVER;database=upsizedCandidate;Integrated Security=True;")
myCommand = New SqlCommand(strUpdateStmt, myConnection)
myConnection.Open()
myCommand.ExecuteNonQuery()
myInfo.EditItemIndex = -1
BindData()
End Sub
Public Sub BindData()
Dim myDataSet As New DataSet
Dim mySqlDataAdapter As SqlDataAdapter
mySqlDataAdapter = New SqlDataAdapter( _
"SELECT * FROM ToddsTable1", _
"server=SQLSERVER;database=upsizedCandidate;Integrated Security=True")
mySqlDataAdapter.Fill(myDataSet, "ToddsTable1")
myInfo.DataSource = myDataSet.Tables("ToddsTable1")
myInfo.DataBind()
End Sub
Editing ToddsTable1 from SQL Server
<asp:datagrid id="myInfo" runat="server"
="" autogeneratecolumns="False" oneditcommand="DataGrid_Edit" width="702px" oncancelcommand="DataGrid_Cancel" onupdatecommand="DataGrid_Update">
<columns>
<asp:editcommandcolumn
canceltext="Cancel"
="" edittext="Edit" updatetext="Update">
<asp:boundcolumn
datafield="myNewCol1"
="" headertext="myNewCol1">
<asp:boundcolumn
datafield="myNewCol2"
="" headertext="myNewCol2">
Everything works fine except when I click"Edit" then edit the text and click "update" it changes every cell in the column to the value I entered in the edited column. Any thoughts on how I could fix this?
|
|
|
|
|
Public Function CePerfMeas1_data(ByVal cost_type1 As String, ByVal cost_type2 As String, ByVal view_type As String, ByVal main_fdate As Date, ByVal main_tdate As Date) As DataTable
Dim CePerfMeas1 As String
Dim dbcomm As OleDb.OleDbCommand
Do
CePerfMeas1 = "select sum(CST_TYP_AMT), CST_TYP_DT from IEIT002_CONTESTM where cost_type = " & cost_type1 & " and project no = ( select project no from IEIT002_CONTESTM where cost_type = " & cost_type2 & " and cost_date between " & beg_date & " and " & end_date & " ) "
dbcomm = New OleDb.OleDbCommand(CePerfMeas1, conn)
Dim da As New OleDb.OleDbDataAdapter(dbcomm)
Dim Ds_CePM1 As New DataTable()
da.Fill(Ds_CePM1)
While (main_fdate <= main_tdate)
beg_date = main_fdate
end_date = DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, main_fdate))
End While
main_fdate = DateAdd(DateInterval.Month, 1, main_fdate)
Loop
Return Ds_CePM1
End Function
|
|
|
|
|
So wat exaclty is the point of this message you started?
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|
|
Another idiotic post, well done.
|
|
|
|
|
using gridview to display information in the tablefrom selected starting date and ending date
please help me with the code for this
oga m
|
|
|
|
|
hi everybody
i want to know how to convert excel sheet to database table (sqlserver database)
Thanks
|
|
|
|
|
For SQL-Server 2000 I normally use a DTS package. For 2005 you can use SSIS.
Alternatively, you should be able to use the OpenRowSet function.
Details of each can be found in Books-Online.
|
|
|
|
|
Create the table with the required columns, and then use sql server import data to import your data from excel to the table you created.
|
|
|
|
|
Youn can use DTS control ( Import and Export data ) ... Goodluck...
NIIT
|
|
|
|
|
Hi,
I need to show a tooltip on Radgrid Hyperlink on mouseover/Mouseout event.
Is it possible to get tooltip for Hyperlink in radgrid.
Please give sugestions
thanks in Advance,
cheers
sangeet
|
|
|
|
|
Set the message in tooltip properties of control properties
Sujit
|
|
|
|
|
hi,
pls help me to find a solution
I have implemented ajax timer in my project,but when we run the app,if we try to access the internet options from tools menu ,the timer event stops from triggering ,then gets back to the same time.So it fails to maintain the time.
so wht could be a better solution,disabling the tool bars or anything else?
pls help
regards
|
|
|
|
|
hi i want dumps in webapplication with C# 2005 ,pls send me
my email id is christo83@gmail.com
|
|
|
|
|
Put it on your xmas list, and see if dumps are delivered
|
|
|
|
|
how to disable a potion without getting selected in the dropdownlist.
Pradeep Reddy
|
|
|
|
|
Wat portion? Please elaborate
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|