C
C#2y ago
Rana

❔ Get Data from Table api c#

when i try to get data from db the message error is : ORA-00942: table or view does not exist.
12 Replies
Rana
RanaOP2y ago
Rana
RanaOP2y ago
SG97
SG972y ago
how are you fetching the data
Rana
RanaOP2y ago
private DemoDBContext _dbContext;

public DataController(DemoDBContext dbContext)
{
_dbContext = dbContext;
}

[HttpGet("GetData")]
public IActionResult Get()
{
try
{

var datas = _dbContext.USERINFOTESTs.ToList();
if (datas.Count == 0)
{
return NotFound();
}
return Ok(datas);
}
catch (Exception ex)
{
return StatusCode(500, ex.Message);
}
private DemoDBContext _dbContext;

public DataController(DemoDBContext dbContext)
{
_dbContext = dbContext;
}

[HttpGet("GetData")]
public IActionResult Get()
{
try
{

var datas = _dbContext.USERINFOTESTs.ToList();
if (datas.Count == 0)
{
return NotFound();
}
return Ok(datas);
}
catch (Exception ex)
{
return StatusCode(500, ex.Message);
}
.
SG97
SG972y ago
can you show the DemoDBContext.cs
Rana
RanaOP2y ago
namespace Test150000.DB
{
public class DemoDBContext :DbContext
{
public DemoDBContext(DbContextOptions<DemoDBContext> options):base(options) {
}
public DbSet<USERINFOTEST> USERINFOTESTs { get; set; }

}
}
namespace Test150000.DB
{
public class DemoDBContext :DbContext
{
public DemoDBContext(DbContextOptions<DemoDBContext> options):base(options) {
}
public DbSet<USERINFOTEST> USERINFOTESTs { get; set; }

}
}
@sn0wgirl_97
SG97
SG972y ago
and the USERINFOTEST.cs ?
Rana
RanaOP2y ago
namespace Test150000.DB
{
public class USERINFOTEST
{

[Key]
public string USER_ID { get; set; }

public DateTime TIMESTAMP { get; set; }

public int STATUS { get; set; }

public int PUNCH { get; set; }
}
}
namespace Test150000.DB
{
public class USERINFOTEST
{

[Key]
public string USER_ID { get; set; }

public DateTime TIMESTAMP { get; set; }

public int STATUS { get; set; }

public int PUNCH { get; set; }
}
}
@sn0wgirl_97 true ? @sn0wgirl_97 .
Pobiega
Pobiega2y ago
have you run migrations? and are you sure the connstr is correct?
Rana
RanaOP2y ago
@Pobiega i dont understand
Pobiega
Pobiega2y ago
ok so first, check your connection string are you sure you are connected to the correct database?
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server