Problem with oledbDataAdapter

AbopisFill

New Member
Hi,<BR><BR>This is my program.<BR><BR><%@Page Language="VB"%><BR><%@Import Namespace="System.Data"%><BR><%@Import Namespace="System.Data.OleDb"%><BR><script runat="server"><BR>Sub Page_Load(obj as Object, e as EventArgs)<BR> Dim myConnection as new OleDbConnection("Provider=SQLOLEDB;data source=localhost;initial catalog=net;UID=sa;pwd=;")<BR> dim odbCmd = new OleDbCommand()<BR> dim odbDA = new OleDbDataAdapter()<BR> dim ds as DataSet = new DataSet()<BR> odbCmd = new OleDbCommand("Calendar1", myConnection)<BR> odbCmd.Parameters.Add(new OleDbParameter("FName", OleDbType.char,20))<BR> odbCmd.Parameters("FName").Value = http://aspmessageboard.com/archive/index.php/"Beulah"<BR> odbDA = new OleDbDataAdapter(odbCmd)<BR> ds = new DataSet()<BR> odbDA.Fill(ds, "Calendar")<BR>End sub<BR></script> <BR><BR>My stored Procedure is :<BR><BR>alter procedure calendar1<BR>(<BR> @FName varchar(20)<BR>)<BR>as <BR>Begin<BR><BR> Select *<BR> from calendar<BR> where Username =@FName or Username = "All"<BR>End<BR><BR>Error:<BR>Procedure 'calendar1' expects parameter '@FName', which was not supplied. <BR><BR>But I have already supplied the parameter and its value.Kindly help of where I went wrong.<BR><BR>thx in advance<BR>White<BR><BR><BR>You should specify that "calender1" is a stored procedure.<BR><BR>odbcmd.commandtype=commandtype.storedprocedure.<BR><BR>add this line after creating an instance of that object.<BR><BR>hope that should work.<BR><BR>soorya.<BR><%@Page Language="VB"%> <BR><%@Import Namespace="System.Data"%> <BR><%@Import Namespace="System.Data.OleDb"%> <BR><script runat="server"> <BR>Sub Page_Load(obj as Object, e as EventArgs) <BR> Dim myConnection as new OleDbConnection("Provider=SQLOLEDB;data source=localhost;initial catalog=Idealnet;UID=sa;pwd=;") <BR> dim odbCmd = new OleDbCommand() <BR> dim odbDA = new OleDbDataAdapter() <BR> dim ds as DataSet = new DataSet() <BR> odbCmd = new OleDbCommand("Calendar1", myConnection) <BR> odbcmd.commandtype=commandtype.storedprocedure <BR> odbCmd.Parameters.Add(new OleDbParameter("FName", OleDbType.char,20)) <BR> odbCmd.Parameters("FName").Value = "Beulah" <BR> odbDA = new OleDbDataAdapter(odbCmd) <BR> ds = new DataSet() <BR> odbDA.Fill(ds, "Calendar") <BR>End sub <BR></script> <BR><BR>This prints me out Nothing.But as such there are no errors. <BR>thx.<BR>
 
Back
Top